lib/phonelib/core.rb in phonelib-0.2.1 vs lib/phonelib/core.rb in phonelib-0.2.2

- old
+ new

@@ -91,10 +91,11 @@ # On first run fills @@phone_data with data present in yaml file def parse(phone, passed_country = nil) load_data country = country_or_default_country(passed_country) - if country.nil? + if phone.nil? || country.nil? + # has to return instance of Phonelib::Phone even if no phone passed Phonelib::Phone.new(phone, @@phone_data) else detected = detect_and_parse_by_country(phone, country) if passed_country.nil? && @@default_country && detected.impossible? Phonelib::Phone.new(phone, @@phone_data)