lib/phony_rails.rb in phony_rails-0.12.3 vs lib/phony_rails.rb in phony_rails-0.12.4
- old
+ new
@@ -20,10 +20,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.gsub!(/[^\d\+]/, '') # Strips weird stuff from the number
+ 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])
options[:add_plus] = true if options[:add_plus].nil?
# (Force) add country_number if missing
# NOTE: do we need to force adding country code? Otherwise we can share lofic with next block