lib/phony_rails.rb in phony_rails-0.0.7 vs lib/phony_rails.rb in phony_rails-0.0.8
- old
+ new
@@ -26,10 +26,10 @@
# This idea came from:
# http://www.redguava.com.au/2011/06/rails-convert-phone-numbers-to-international-format-for-sms/
def self.normalize_number(number, options = {})
return if number.nil?
number = number.clone # Just to be sure, we don't want to change the original.
- number = Phony::CountryCodes.instance.clean(number) # Strips weird stuff from the number
+ number.gsub!(/[^\d\+]/, '') # Strips weird stuff from the number
return if number.blank?
if country_number = COUNTRY_NUMBER[options[:country_code] || options[:default_country_code]]
# Add country_number if missing
number = "#{country_number}#{number}" if not number =~ /^(00|\+)?#{country_number}/
end
\ No newline at end of file