mm_geoip 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mm_geoip/version.rb +1 -1
- data/lib/mm_geoip.rb +11 -7
- metadata +2 -2
data/lib/mm_geoip/version.rb
CHANGED
data/lib/mm_geoip.rb
CHANGED
@@ -42,23 +42,27 @@ class MMGeoip
|
|
42
42
|
#
|
43
43
|
# Here, we look for both forms and the plain version.
|
44
44
|
#
|
45
|
-
@env[field] || @env["GEOIP_#{field.upcase}"] || @env["X_GEOIP_#{field.upcase}"]
|
45
|
+
@env[field] || @env["GEOIP_#{field.to_s.upcase}"] || @env["X_GEOIP_#{field.to_s.upcase}"]
|
46
46
|
end
|
47
47
|
|
48
48
|
def region_name
|
49
|
-
MMGeoip::Regions[country_code.to_sym] && MMGeoip::Regions[country_code.to_sym][region]
|
49
|
+
country_code && MMGeoip::Regions[country_code.to_sym] && MMGeoip::Regions[country_code.to_sym][region]
|
50
50
|
end
|
51
51
|
|
52
52
|
def looked_up?
|
53
53
|
!!@lookup
|
54
54
|
end
|
55
55
|
|
56
|
-
def lookup
|
57
|
-
return @lookup if @lookup
|
56
|
+
def lookup
|
57
|
+
return @lookup if @lookup
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
@lookup
|
59
|
+
looked_up_fields = @geodb.city @env[:ip]
|
60
|
+
|
61
|
+
return @lookup = {} unless looked_up_fields
|
62
|
+
|
63
|
+
@lookup = Hash[FIELDS.zip looked_up_fields]
|
64
|
+
@lookup[:region_name] = region_name
|
65
|
+
@lookup
|
62
66
|
end
|
63
67
|
|
64
68
|
def self.data_path
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: mm_geoip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Niko Dittmann
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-05 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: geoip
|