Class: TelephoneNumber::NumberFormat
- Inherits:
-
Object
- Object
- TelephoneNumber::NumberFormat
- Defined in:
- lib/telephone_number/number_format.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#intl_format ⇒ Object
readonly
Returns the value of attribute intl_format.
-
#leading_digits ⇒ Object
readonly
Returns the value of attribute leading_digits.
-
#national_prefix_formatting_rule ⇒ Object
readonly
Returns the value of attribute national_prefix_formatting_rule.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Instance Method Summary collapse
-
#initialize(data_hash, country_prefix_formatting_rule) ⇒ NumberFormat
constructor
A new instance of NumberFormat.
Constructor Details
#initialize(data_hash, country_prefix_formatting_rule) ⇒ NumberFormat
Returns a new instance of NumberFormat.
6 7 8 9 10 11 12 |
# File 'lib/telephone_number/number_format.rb', line 6 def initialize(data_hash, country_prefix_formatting_rule) @pattern = Regexp.new(data_hash[:pattern]) if data_hash[:pattern] @leading_digits = Regexp.new(data_hash[:leading_digits]) if data_hash[:leading_digits] @format = data_hash[:format] @intl_format = data_hash[:intl_format] @national_prefix_formatting_rule = data_hash[:national_prefix_formatting_rule] || country_prefix_formatting_rule end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
4 5 6 |
# File 'lib/telephone_number/number_format.rb', line 4 def format @format end |
#intl_format ⇒ Object (readonly)
Returns the value of attribute intl_format.
4 5 6 |
# File 'lib/telephone_number/number_format.rb', line 4 def intl_format @intl_format end |
#leading_digits ⇒ Object (readonly)
Returns the value of attribute leading_digits.
4 5 6 |
# File 'lib/telephone_number/number_format.rb', line 4 def leading_digits @leading_digits end |
#national_prefix_formatting_rule ⇒ Object (readonly)
Returns the value of attribute national_prefix_formatting_rule.
4 5 6 |
# File 'lib/telephone_number/number_format.rb', line 4 def national_prefix_formatting_rule @national_prefix_formatting_rule end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
4 5 6 |
# File 'lib/telephone_number/number_format.rb', line 4 def pattern @pattern end |