lib/phonelib/phone_analyzer.rb in phonelib-0.3.0 vs lib/phonelib/phone_analyzer.rb in phonelib-0.3.1
- old
+ new
@@ -15,10 +15,10 @@
def analyze(phone, passed_country)
country = country_or_default_country passed_country
result = try_to_parse_single_country(phone, country)
# if previous parsing failed, trying for all countries
- if result.nil? || result.values.first[:valid].empty?
+ if result.nil? || result.empty? || result.values.first[:valid].empty?
result = detect_and_parse phone
end
result
end