Module: Ip2region
- Defined in:
- lib/ip2region.rb,
lib/ip2region/version.rb,
lib/ip2region/xdb_searcher.rb
Defined Under Namespace
Classes: Error, XdbSearcher
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
-
.ip_2_region_path=(path) ⇒ Object
Your code goes here…
- .search(ip) ⇒ Object
Class Method Details
.ip_2_region_path=(path) ⇒ Object
Your code goes here…
10 11 12 |
# File 'lib/ip2region.rb', line 10 def self.ip_2_region_path=(path) @@ip_2_region_path = path end |
.search(ip) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ip2region.rb', line 14 def self.search(ip) if @@ip_2_region_path.nil? throw "需要先运行 Ip2region.ip_2_region_path = XDB_PATH" end XdbSearcher.xdb_path = @@ip_2_region_path searcher = XdbSearcher.instance searcher.search(ip) end |