Sha256: 17e22a380b2d8f1d619c274d496d5a2bf3e89be0193e4818fd5e1bff7c69a7d8

Contents?: true

Size: 390 Bytes

Versions: 3

Compression:

Stored size: 390 Bytes

Contents

module ValidatesTelephone
  class Validator
    def initialize(number, locale = :any)
      locale ||= :any
      @number = number
      @match = ValidatesTelephone::Regex.send(locale, @number)
      @number = ValidatesTelephone::Formatter.send(locale, @number)
    end

    def valid?
      return true if @number.blank?
      @match
    end

    def number
      @number
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
validates_telephone-2.0.2 lib/validates_telephone/validator.rb
validates_telephone-2.0.1 lib/validates_telephone/validator.rb
validates_telephone-2.0.0 lib/validates_telephone/validator.rb