china_ad_ip 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6ba5c5e3238ba511cd510a3fe191f3e5baa9f41
4
- data.tar.gz: fa11f5da3663333097cdb2447fa01e257a129fe4
3
+ metadata.gz: 1c9308d7c16f1fd0d16c4454a9a77c654dc5bdcd
4
+ data.tar.gz: 482b0e42b7abe1634dc5fc93ee6a8334fd6884ce
5
5
  SHA512:
6
- metadata.gz: 975cc172495b7545d3c068008d9df717a41b62abf4871206f22ca2ead315d8f9cf62fce3700f56f64f668d6c617d905f5334316c37bf1f235bba4e34e90e5e31
7
- data.tar.gz: d28ff8fd49dd83193da2c359606e4b146ef371b38f2f269f4571878d56d09a23038481578d9b2d0d0d0fda56d3521bc6da4e125e833b3b3e1c4c8fa51341d708
6
+ metadata.gz: 9a9da6df919e5d79c814d7355a2582ab9ad9554031e8701884da023504ba71cbd8488fc1a767e935bfe9a57eacd6adf488bef2c32d6f33b531845985bdc29ebb
7
+ data.tar.gz: 161cdfc0ff74af14cbdac61f4a7169d0fe56ea007a7913882fd328c2905f8aa9bfbfda366439addac526f6b418bd9d546dc6bbaa8f7f5e0faefbb3c92e14a301
data/README.md CHANGED
@@ -26,7 +26,7 @@ Or install it yourself as:
26
26
 
27
27
  ## Contributing
28
28
 
29
- 1. Fork it ( https://github.com/[my-github-username]/china_ad_ip/fork )
29
+ 1. Fork it ( https://github.com/suzhen/china_ad_ip/fork )
30
30
  2. Create your feature branch (`git checkout -b my-new-feature`)
31
31
  3. Commit your changes (`git commit -am 'Add some feature'`)
32
32
  4. Push to the branch (`git push origin my-new-feature`)
@@ -1,3 +1,3 @@
1
1
  module ChinaAdIp
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/china_ad_ip.rb CHANGED
@@ -52,8 +52,8 @@ module ChinaAdIp
52
52
  raise(::ArgumentError, "not exists: #{path}")
53
53
  else
54
54
  if $locations.nil?
55
- $locations = CSV.read(path)
56
- $locations = Hash[$locations.map {|location| [location.shift,location] }]
55
+ $locations = CSV.read(path,:encoding=>"utf-8")
56
+ $locations = Hash[$locations.map {|location| id = location.shift; [id,location << !!id.match(/^1156/)] }]
57
57
  end
58
58
  end
59
59
  end
@@ -67,7 +67,7 @@ module ChinaAdIp
67
67
 
68
68
  index = dichotomy(ip_addr.to_i,$ip_sections.collect{|ip_section| ip_section[0]}.to_a)
69
69
 
70
- $locations[$ip_sections[index][2]].to_s
70
+ $locations[$ip_sections[index][2]]
71
71
  else
72
72
  raise(::ArgumentError, "not exists csv data")
73
73
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: china_ad_ip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - suezhen