motion/core_ext/numeric/conversions.rb
def to_formatted_s(format = :default, options = {})
    case format
    when :phone
      return MotionSupport::NumberHelper.number_to_phone(self, options)
    else
      self.to_default_s
    end
  end
# Provides options for converting numbers into formatted strings.
# Right now, options are only provided for phone numbers.
#
# ==== Options
#
# For details on which formats use which options, see MotionSupport::NumberHelper
#
# ==== Examples
#
#  Phone Numbers:
#  5551234.to_s(:phone)                                     # => 555-1234
#  1235551234.to_s(:phone)                                  # => 123-555-1234
#  1235551234.to_s(:phone, area_code: true)                 # => (123) 555-1234
#  1235551234.to_s(:phone, delimiter: ' ')                  # => 123 555 1234
#  1235551234.to_s(:phone, area_code: true, extension: 555) # => (123) 555-1234 x 555
#  1235551234.to_s(:phone, country_code: 1)                 # => +1-123-555-1234
#  1235551234.to_s(:phone, country_code: 1, extension: 1343, delimiter: '.')
#  # => +1.123.555.1234 x 1343
Provides options for converting numbers into formatted strings.
Right now, options are only provided for phone numbers.

Options

For details on which formats use which options, see MotionSupport::NumberHelper

Examples


Provides options for converting numbers into formatted strings . Right now options are only provided for phone numbers . Options For details on which formats use which options see MotionSupport :: NumberHelper Examples
def to_formatted_s(format = :default, options = {})
    case format
    when :phone
      return MotionSupport::NumberHelper.number_to_phone(self, options)
    else
      self.to_default_s
    end
  end
def to_formatted_s ( format = :default , options = { } ) case format when :phone return MotionSupport :: NumberHelper . number_to_phone ( self , options ) else self . to_default_s end end
Provides options for converting numbers into formatted strings.
Provides options for converting numbers into formatted strings .
format
options