Module: Autometal::Geolocatable
- Defined in:
- lib/geoip/geolocatable.rb
Instance Method Summary collapse
- #city ⇒ Object
- #country ⇒ Object
- #county ⇒ Object
- #geo_attr ⇒ Object
- #geoip_city ⇒ Object
- #geoip_org ⇒ Object
- #lat ⇒ Object
- #latlng ⇒ Object (also: #latlon)
- #lng ⇒ Object
- #organization ⇒ Object
Instance Method Details
#city ⇒ Object
29 |
# File 'lib/geoip/geolocatable.rb', line 29 def city; geoip_city.city if geoip_city; end |
#country ⇒ Object
25 |
# File 'lib/geoip/geolocatable.rb', line 25 def country; geoip_city.country if geoip_city; end |
#county ⇒ Object
27 |
# File 'lib/geoip/geolocatable.rb', line 27 def county; geoip_city.county if geoip_city; end |
#geo_attr ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/geoip/geolocatable.rb', line 18 def geo_attr begin send(:ip) rescue NoMethodError send(:domain) end end |
#geoip_city ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/geoip/geolocatable.rb', line 3 def geoip_city @geoip_city = false unless @geoip_city if Autometal::Geoip::City.installed? @geoip_city = Autometal::Geoip::City.new(geo_attr) unless @geoip_city end @geoip_city end |
#geoip_org ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/geoip/geolocatable.rb', line 10 def geoip_org @geoip_org = false unless @geoip_org if Autometal::Geoip::Organization.installed? @geoip_org = Autometal::Geoip::Organization.new(geo_attr) unless @geoip_org end @geoip_org end |
#lat ⇒ Object
31 |
# File 'lib/geoip/geolocatable.rb', line 31 def lat; geoip_city.lat if geoip_city; end |
#latlng ⇒ Object Also known as: latlon
37 |
# File 'lib/geoip/geolocatable.rb', line 37 def latlng; geoip_city.latlng if geoip_city; end |
#lng ⇒ Object
33 |
# File 'lib/geoip/geolocatable.rb', line 33 def lng; geoip_city.lng if geoip_city; end |
#organization ⇒ Object
35 |
# File 'lib/geoip/geolocatable.rb', line 35 def organization; geoip_org.organization if geoip_org; end |