Sha256: 8aa7d00f84db0a176f9854f8957813b42bb5eda255b272b9880d78726b276124

Contents?: true

Size: 756 Bytes

Versions: 30

Compression:

Stored size: 756 Bytes

Contents

module TelephoneNumber
  module ClassMethods
    attr_accessor :override_file, :default_format_string
    attr_reader :default_format_pattern

    def default_format_pattern=(format_string)
      @default_format_pattern = Regexp.new(format_string)
    end

    def parse(number, country = nil)
      TelephoneNumber::Number.new(number, country)
    end

    def valid?(number, country = nil, keys = [])
      parse(number, country).valid?(keys)
    end

    def invalid?(*args)
      !valid?(*args)
    end

    def sanitize(input_number)
      input_number.to_s.gsub(/\D/, '')
    end

    # generates binary file from xml that user gives us
    def generate_override_file(file)
      PhoneDataImporter.new(file, override: true).import!
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
telephone_number-1.4.22 lib/telephone_number/class_methods.rb
telephone_number-1.4.21 lib/telephone_number/class_methods.rb
telephone_number-1.4.20 lib/telephone_number/class_methods.rb
telephone_number-1.4.19 lib/telephone_number/class_methods.rb
telephone_number-1.4.18 lib/telephone_number/class_methods.rb
telephone_number-1.4.16 lib/telephone_number/class_methods.rb
telephone_number-1.4.15 lib/telephone_number/class_methods.rb
telephone_number-1.4.14 lib/telephone_number/class_methods.rb
telephone_number-1.4.13 lib/telephone_number/class_methods.rb
telephone_number-1.4.12 lib/telephone_number/class_methods.rb
telephone_number-1.4.11 lib/telephone_number/class_methods.rb
telephone_number-1.4.10 lib/telephone_number/class_methods.rb
telephone_number-1.4.9 lib/telephone_number/class_methods.rb
telephone_number-1.4.8 lib/telephone_number/class_methods.rb
telephone_number-1.4.7 lib/telephone_number/class_methods.rb
telephone_number-1.4.6 lib/telephone_number/class_methods.rb
telephone_number-1.4.5 lib/telephone_number/class_methods.rb
telephone_number-1.4.4 lib/telephone_number/class_methods.rb
telephone_number-1.4.3 lib/telephone_number/class_methods.rb
telephone_number-1.4.2 lib/telephone_number/class_methods.rb