Class: ValidateZipcode::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/validate_zipcode/validator.rb

Instance Method Summary collapse

Constructor Details

#initialize(zipcode, locale) ⇒ Validator

Returns a new instance of Validator.



3
4
5
6
# File 'lib/validate_zipcode/validator.rb', line 3

def initialize(zipcode, locale)
  @zipcode = zipcode
  variables(locale) unless @zipcode.blank?
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


8
9
10
11
# File 'lib/validate_zipcode/validator.rb', line 8

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