lib/phonelib/phone_analyzer_helper.rb in phonelib-0.6.15 vs lib/phonelib/phone_analyzer_helper.rb in phonelib-0.6.16
- old
+ new
@@ -103,10 +103,10 @@
def full_regex_for_data(data, type, country_optional = true)
regex = []
regex << "(#{data[Core::INTERNATIONAL_PREFIX]})?"
regex << "(#{data[Core::COUNTRY_CODE]})#{country_optional ? '?' : ''}"
regex << "(#{data[Core::NATIONAL_PREFIX_FOR_PARSING] || data[Core::NATIONAL_PREFIX]})?"
- regex << "(#{type_regex(data[Core::TYPES][Core::GENERAL], type)})"
+ regex << "(#{type_regex(data[Core::TYPES][Core::GENERAL], type)})" if data[Core::TYPES]
cr("^#{regex.join}$")
end
# Returns regex for type with special types if needed