Sha256: ace4f556ea30b3f66f97971af0e1323bade434b97513360a3757741c90524bfb
Contents?: true
Size: 580 Bytes
Versions: 2
Compression:
Stored size: 580 Bytes
Contents
require 'geocoder2' module Geocoder2 module Request def location unless defined?(@location) if env.has_key?('HTTP_X_REAL_IP') @location = Geocoder2.search(env['HTTP_X_REAL_IP']).first elsif env.has_key?('HTTP_X_FORWARDED_FOR') @location = Geocoder2.search(env['HTTP_X_FORWARDED_FOR'].split(/\s*,\s*/)[0]).first else @location = Geocoder2.search(ip).first end end @location end end end if defined?(Rack) and defined?(Rack::Request) Rack::Request.send :include, Geocoder2::Request end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
geocoder2-0.1.1 | lib/geocoder2/request.rb |
geocoder2-0.1.0 | lib/geocoder2/request.rb |