Module: Interage::PhoneHelper

Included in:
ApplicationHelper
Defined in:
lib/interage/phone_helper.rb

Instance Method Summary collapse

Instance Method Details

#format_phone(phone) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/interage/phone_helper.rb', line 5

def format_phone(phone)
  return if phone.blank?

  phone.to_s.gsub!(/[^0-9]/, '')

  "(#{phone[0, 2]}) #{phone[3, 5]}-#{phone[8, 4]}".strip
end