Sha256: c204167e7036e36bd1904158b2628e56b6ca0c82542d502de257866d6d13a7d1
Contents?: true
Size: 574 Bytes
Versions: 4
Compression:
Stored size: 574 Bytes
Contents
require 'geocoder' module Geocoder module Request def location unless defined?(@location) if env.has_key?('HTTP_X_REAL_IP') @location = Geocoder.search(env['HTTP_X_REAL_IP']).first elsif env.has_key?('HTTP_X_FORWARDED_FOR') @location = Geocoder.search(env['HTTP_X_FORWARDED_FOR'].split(/\s*,\s*/)[0]).first else @location = Geocoder.search(ip).first end end @location end end end if defined?(Rack) and defined?(Rack::Request) Rack::Request.send :include, Geocoder::Request end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
geocoder-1.1.9 | lib/geocoder/request.rb |
geocoder-1.1.8 | lib/geocoder/request.rb |
geocoder-1.1.7 | lib/geocoder/request.rb |
geocoder-sgonyea-1.1.6.1 | lib/geocoder/request.rb |