lib/phone.rb
# Formats the phone number.
#
# if the method argument is a String, it is used as a format string, with the following fields being interpolated:
#
# * %c - country_code (385)
# * %a - area_code (91)
# * %A - area_code with leading zero (091)
# * %n - number (5125486)
# * %f - first @@n1_length characters of number (configured through Phone.n1_length), default is 3 (512)
# * %l - last characters of number (5486)
# * %x - entire extension
#
# if the method argument is a Symbol, it is used as a lookup key for a format String in Phone.named_formats
#   pn.format(:europe)
Formats the phone number.
if the method argument is a String, it is used as a format string, with the following fields being interpolated.



if the method argument is a Symbol, it is used as a lookup key for a format String in Phone.named_formats
pn.format(:europe)
Formats the phone number . if the method argument is a String it is used as a format string with the following fields being interpolated . if the method argument is a Symbol it is used as a lookup key for a format String in Phone . named_formats pn . format ( : europe )
def format(fmt)
      if fmt.is_a?(Symbol)
        raise "The format #{fmt} doesn't exist" unless named_formats.has_key?(fmt)
        format_number named_formats[fmt]
      else
        format_number(fmt)
      end
    end
def format ( fmt ) if fmt . is_a? ( Symbol ) raise "The format #{fmt} doesn't exist" unless named_formats . has_key? ( fmt ) format_number named_formats [ fmt ] else format_number ( fmt ) end end
Formats the phone number.
Formats the phone number .
fmt
<not_specific>