lib/rack/geo_locale.rb in rack-geo-locale-0.0.2 vs lib/rack/geo_locale.rb in rack-geo-locale-0.0.3

- old
+ new

@@ -16,20 +16,18 @@ @app.call(env) end private def parse_country(env) - remote_addr = env["REMOTE_ADDR"] + if database? + if remote_addr = env["REMOTE_ADDR"] + result = geoip.country(remote_addr).country_code2 - return nil unless remote_addr - - result = geoip.country(remote_addr).country_code2 - - if result != "--" - result - else - nil + return result if result != "--" + end end + + nil end def parse_locale(env) env["HTTP_ACCEPT_LANGUAGE"] ||= "" language_ranges = env["HTTP_ACCEPT_LANGUAGE"].split(",")