Sha256: deec2c80a7553e6e96e828cd135b1bc41b36fe91c92adc11fe02e4af5d20c02d

Contents?: true

Size: 366 Bytes

Versions: 3

Compression:

Stored size: 366 Bytes

Contents

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

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

    def number
      @number
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
validates_telephone-1.1.0 lib/validates_telephone/validator.rb
validates_telephone-1.0.1 lib/validates_telephone/validator.rb
validates_telephone-1.0.0 lib/validates_telephone/validator.rb