Module: WorldFlags::Geo

Defined in:
lib/world_flags/locale_helper.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ip_country_codeObject



24
25
26
# File 'lib/world_flags/locale_helper.rb', line 24

def self.ip_country_code
	@ip_country_code ||= ip_json.parsed_response['country_code']
end

.ip_jsonObject



20
21
22
# File 'lib/world_flags/locale_helper.rb', line 20

def self.ip_json
  HTTParty.get('http://freegeoip.net/json/')
end

Instance Method Details

#ip_country_codeObject



28
29
30
# File 'lib/world_flags/locale_helper.rb', line 28

def ip_country_code
	WorldFlags::Geo.ip_country_code
end