Class: Formatters::FormatPhone
- Includes:
- ActionView::Helpers::NumberHelper
- Defined in:
- lib/formatters/format_phone.rb
Instance Method Summary collapse
- #from(value, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ FormatPhone
constructor
A new instance of FormatPhone.
- #to(str, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ FormatPhone
Returns a new instance of FormatPhone.
8 9 |
# File 'lib/formatters/format_phone.rb', line 8 def initialize( = {}) end |
Instance Method Details
#from(value, options = {}) ⇒ Object
11 12 13 |
# File 'lib/formatters/format_phone.rb', line 11 def from(value, = {}) number_to_phone value, end |
#to(str, options = {}) ⇒ Object
15 16 17 18 |
# File 'lib/formatters/format_phone.rb', line 15 def to(str, = {}) return nil if str.nil? or str.empty? str.gsub(/[^0-9]/, '').to_i end |