Module: ValidatesZipcode

Defined in:
lib/validates_zipcode/cldr_regex_collection.rb,
lib/validates_zipcode.rb,
lib/validates_zipcode/railtie.rb,
lib/validates_zipcode/version.rb,
lib/validates_zipcode/zipcode.rb,
lib/validates_zipcode/formatter.rb,
lib/validates_zipcode/validator.rb,
lib/validates_zipcode/invalid_zipcode_error.rb

Overview

Defined Under Namespace

Modules: CldrRegexpCollection Classes: Formatter, InvalidZipcodeError, Railtie, Validator, Zipcode

Constant Summary collapse

VERSION =
'0.3.0'

Class Method Summary collapse

Class Method Details

.build_zipcode(zipcode, country_alpha2, options = {}) ⇒ Object


20
21
22
# File 'lib/validates_zipcode.rb', line 20

def self.build_zipcode(zipcode, country_alpha2, options = {})
  ValidatesZipcode::Zipcode.new(options.merge(zipcode: zipcode, country_alpha2: country_alpha2))
end

.format(*args) ⇒ Object


16
17
18
# File 'lib/validates_zipcode.rb', line 16

def self.format(*args)
  build_zipcode(*args).format
end

.valid?(*args) ⇒ Boolean

Returns:

  • (Boolean)

12
13
14
# File 'lib/validates_zipcode.rb', line 12

def self.valid?(*args)
  build_zipcode(*args).valid?
end