Module: Phonie

Defined in:
lib/phonie/phone.rb,
lib/phonie/parser.rb,
lib/phonie/country.rb,
lib/phonie/version.rb,
lib/phonie/formatter.rb,
lib/phonie/configuration.rb

Overview

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)

Defined Under Namespace

Classes: Configuration, Country, Formatter, Parser, Phone

Constant Summary collapse

VERSION =
'3.3.1'

Class Method Summary collapse

Class Method Details

.configurationObject



28
29
30
# File 'lib/phonie/configuration.rb', line 28

def self.configuration
  Configuration.instance
end

.configure {|configuration| ... } ⇒ Object

Yields:



24
25
26
# File 'lib/phonie/configuration.rb', line 24

def self.configure(&block)
  yield configuration
end