Flowdock
number_to_phone(number, options = {}) public

Formats a number into a US phone number string. The options can be a hash used to customize the format of the output. The area code can be surrounded by parentheses by setting :area_code to true; default is false The delimiter can be set using :delimiter; default is "-" Examples:

  number_to_phone(1235551234)   => 123-555-1234
  number_to_phone(1235551234, {:area_code => true})   => (123) 555-1234
  number_to_phone(1235551234, {:delimiter => " "})    => 123 555 1234
  number_to_phone(1235551234, {:area_code => true, :extension => 555})  => (123) 555-1234 x 555
Show source
Register or log in to add new notes.