Module: TelephoneNumber::ClassMethods
- Included in:
- TelephoneNumber
- Defined in:
- lib/telephone_number/class_methods.rb
Instance Attribute Summary collapse
-
#default_format_pattern ⇒ Object
Returns the value of attribute default_format_pattern.
-
#default_format_string ⇒ Object
Returns the value of attribute default_format_string.
-
#override_file ⇒ Object
Returns the value of attribute override_file.
Instance Method Summary collapse
-
#generate_override_file(file) ⇒ Object
generates binary file from xml that user gives us.
- #invalid?(*args) ⇒ Boolean
- #parse(number, country = nil) ⇒ Object
- #sanitize(input_number) ⇒ Object
- #valid?(number, country = nil, keys = []) ⇒ Boolean
Instance Attribute Details
#default_format_pattern ⇒ Object
Returns the value of attribute default_format_pattern.
4 5 6 |
# File 'lib/telephone_number/class_methods.rb', line 4 def default_format_pattern @default_format_pattern end |
#default_format_string ⇒ Object
Returns the value of attribute default_format_string.
3 4 5 |
# File 'lib/telephone_number/class_methods.rb', line 3 def default_format_string @default_format_string end |
#override_file ⇒ Object
Returns the value of attribute override_file.
3 4 5 |
# File 'lib/telephone_number/class_methods.rb', line 3 def override_file @override_file end |
Instance Method Details
#generate_override_file(file) ⇒ Object
generates binary file from xml that user gives us
27 28 29 |
# File 'lib/telephone_number/class_methods.rb', line 27 def generate_override_file(file) PhoneDataImporter.new(file, override: true).import! end |
#invalid?(*args) ⇒ Boolean
18 19 20 |
# File 'lib/telephone_number/class_methods.rb', line 18 def invalid?(*args) !valid?(*args) end |
#parse(number, country = nil) ⇒ Object
10 11 12 |
# File 'lib/telephone_number/class_methods.rb', line 10 def parse(number, country = nil) TelephoneNumber::Number.new(number, country) end |
#sanitize(input_number) ⇒ Object
22 23 24 |
# File 'lib/telephone_number/class_methods.rb', line 22 def sanitize(input_number) input_number.to_s.gsub(/\D/, '') end |
#valid?(number, country = nil, keys = []) ⇒ Boolean
14 15 16 |
# File 'lib/telephone_number/class_methods.rb', line 14 def valid?(number, country = nil, keys = []) parse(number, country).valid?(keys) end |