Class: Tact::PhoneNumber
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Tact::PhoneNumber
- Defined in:
- lib/tact/phone_number.rb
Instance Method Summary collapse
Instance Method Details
#format_number ⇒ Object
15 16 17 18 |
# File 'lib/tact/phone_number.rb', line 15 def format_number n = number.gsub(/[^\d]/, "") self.number = n.gsub(/\A(?:\d{1,3})?(\d{3})(\d{3})(\d{4})\z/, '(\1) \2-\3') end |
#to_s ⇒ Object
11 12 13 |
# File 'lib/tact/phone_number.rb', line 11 def to_s "#{kind.yellow}: #{number.bold}" end |