From a63d8cd9e165cecb3f083eb80fd0ac048464d312 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Tue, 3 Dec 2013 19:55:40 -0200 Subject: Make both conversion methods work similarly The conversion without area code already changed the passed number in place, so change the other method to do the same. --- .../lib/active_support/number_helper/number_to_phone_converter.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/number_helper/number_to_phone_converter.rb b/activesupport/lib/active_support/number_helper/number_to_phone_converter.rb index e7840e98c3..045f86c10f 100644 --- a/activesupport/lib/active_support/number_helper/number_to_phone_converter.rb +++ b/activesupport/lib/active_support/number_helper/number_to_phone_converter.rb @@ -18,7 +18,8 @@ module ActiveSupport end def convert_with_area_code(number) - number.gsub(/(\d{1,3})(\d{3})(\d{4}$)/,"(\\1) \\2#{delimiter}\\3") + number.gsub!(/(\d{1,3})(\d{3})(\d{4}$)/,"(\\1) \\2#{delimiter}\\3") + number end def convert_without_area_code(number) -- cgit v1.2.3