lib/phony_rails.rb in phony_rails-0.6.2 vs lib/phony_rails.rb in phony_rails-0.7.0
- old
+ new
@@ -23,15 +23,14 @@
number = number.clone # Just to be sure, we don't want to change the original.
number.gsub!(/[^\d\+]/, '') # Strips weird stuff from the number
return if number.blank?
if country_number = options[:country_number] || country_number_for(options[:country_code])
# (Force) add country_number if missing
- number = "#{country_number}#{number}" if not number =~ /^(00|\+)?#{country_number}/
+ number = "#{country_number}#{number}" if not number =~ /\A(00|\+)?#{country_number}/
elsif default_country_number = options[:default_country_number] || country_number_for(options[:default_country_code])
# Add default_country_number if missing
- number = "#{default_country_number}#{number}" if not number =~ /^(00|\+|#{default_country_number})/
+ number = "#{default_country_number}#{number}" if not number =~ /\A(00|\+|#{default_country_number})/
end
-
Phony.normalize(number)
rescue
number # If all goes wrong .. we still return the original input.
end