Class: Barometer::Query::Format::Postalcode
- Defined in:
- lib/barometer/query/formats/postalcode.rb
Overview
eg. H0H 0H0
Class Method Summary collapse
Methods inherited from Base
Class Method Details
.geo(query) ⇒ Object
8 |
# File 'lib/barometer/query/formats/postalcode.rb', line 8 def self.geo(query); {country_code: 'CA'}; end |
.regex ⇒ Object
9 10 11 12 13 14 |
# File 'lib/barometer/query/formats/postalcode.rb', line 9 def self.regex # Rules: no D, F, I, O, Q, or U anywhere # Basic validation: ^[ABCEGHJ-NPRSTVXY]{1}[0-9]{1}[ABCEGHJ-NPRSTV-Z]{1} # [ ]?[0-9]{1}[ABCEGHJ-NPRSTV-Z]{1}[0-9]{1}$ /^[A-Z]{1}[\d]{1}[A-Z]{1}[ ]?[\d]{1}[A-Z]{1}[\d]{1}$/ end |