mm_geoip 0.0.3 → 0.0.4

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.
data/data/GeoLiteCity.dat CHANGED
Binary file
@@ -1,3 +1,3 @@
1
1
  class MMGeoip
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
data/lib/mm_geoip.rb CHANGED
@@ -16,7 +16,7 @@ class MMGeoip
16
16
 
17
17
  def initialize(env)
18
18
  @env = env # may be a Rack @env or any hash containing initial data
19
- @env[:ip] ||= @env["REMOTE_ADDR"] # :ip or "REMOTE_ADDR" should be present
19
+ @env[:ip] ||= @env["HTTP_X_REAL_IP"] || @env["HTTP_X_FORWARDED_FOR"] || @env["REMOTE_ADDR"]
20
20
 
21
21
  raise NoIpGiven.new unless @env[:ip]
22
22
 
@@ -60,7 +60,7 @@ class MMGeoip
60
60
 
61
61
  return @lookup = {} unless looked_up_fields
62
62
 
63
- @lookup = Hash[FIELDS.zip looked_up_fields]
63
+ @lookup = Hash[FIELDS.zip looked_up_fields.to_a]
64
64
  @lookup[:region_name] = region_name
65
65
  @lookup
66
66
  end
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.3
5
+ version: 0.0.4
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-05 00:00:00 Z
13
+ date: 2011-06-06 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: geoip