Skip to content

Commit

Permalink
suport crystal 0.34.0 or later
Browse files Browse the repository at this point in the history
  • Loading branch information
arcage committed May 21, 2020
1 parent da9e5c0 commit 4a42390
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ authors:
- ʕ·ᴥ·ʔAKJ <[email protected]>

license: MIT

crystal: 0.34.0
2 changes: 1 addition & 1 deletion src/ip2country/cc2country.cr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class IP2Country::CC2Country
IP2Country::LANGS.each do |lang|
uri = URI.parse("https://raw.githubusercontent.com/umpirsky/country-list/master/data/#{lang}/country.yaml")
cache_file = CACHE_DIR + "/#{lang}.yaml"
mtime = File.exists?(cache_file) ? File.info(cache_file).modification_time : Time.new(2000, 1, 1)
mtime = File.exists?(cache_file) ? File.info(cache_file).modification_time : Time.utc(2000, 1, 1)
http = HTTP::Client.new(uri)
headers = HTTP::Headers.new
headers["If-modified-since"] = HTTP.format_time(mtime)
Expand Down
2 changes: 1 addition & 1 deletion src/ip2country/ip2cc.cr
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class IP2Country::IP2CC
def initialize(@name, uri_string : String)
@uri = URI.parse(uri_string)
@cache_file = CACHE_DIR + "/#{@name}.dat"
@mtime = File.exists?(@cache_file) ? File.info(@cache_file).modification_time : Time.new(2000, 1, 1)
@mtime = File.exists?(@cache_file) ? File.info(@cache_file).modification_time : Time.utc(2000, 1, 1)
end

def cache_update : Bool
Expand Down
2 changes: 1 addition & 1 deletion src/ip2country/ipaddr.cr
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct IP2Country::IPAddr
end

def octet(index : Int) : UInt8
(@value >> ((3 - index) * 8)).to_u8
((@value >> ((3 - index) * 8)) & 255).to_u8
end

def octets
Expand Down

0 comments on commit 4a42390

Please sign in to comment.