Module: SerbiaZipCodes
- Defined in:
- lib/serbia_zip_codes.rb
Class Method Summary collapse
-
.find_by_city(city = nil) ⇒ Array
Search for zip code by city.
-
.find_by_zip(zip = nil) ⇒ Array
Search for city by zip code.
Class Method Details
.find_by_city(city = nil) ⇒ Array
Search for zip code by city
18 19 20 |
# File 'lib/serbia_zip_codes.rb', line 18 def self.find_by_city(city = nil) @data.select { |d| d["city"].match /#{city}/i } end |
.find_by_zip(zip = nil) ⇒ Array
Search for city by zip code
10 11 12 |
# File 'lib/serbia_zip_codes.rb', line 10 def self.find_by_zip(zip = nil) @data.select { |d| d["zip_code"].match /#{zip}/i } end |