class Municipitaly::Zone

Define data structure for a Zone

Attributes

code[R]
name[R]

Public Class Methods

all() click to toggle source

returns an array of all Municipitaly::Zone objects.

# File lib/municipitaly/zone.rb, line 16
def self.all
  data.zones
end
new(name:, code:) click to toggle source
# File lib/municipitaly/zone.rb, line 8
def initialize(name:, code:)
  @name = name
  @code = code
end

Public Instance Methods

municipalities() click to toggle source

returns an array of all Municipitaly::Municipality objects belongs to current zone.

# File lib/municipitaly/zone.rb, line 34
def municipalities
  @municipalities ||= Search.municipalities_from_zone_code(code)
end
provinces() click to toggle source

returns an array of all Municipitaly::Province objects belongs to current zone.

# File lib/municipitaly/zone.rb, line 28
def provinces
  @provinces ||= Search.provinces_from_zone_code(code)
end
regions() click to toggle source

returns an array of all Municipitaly::Region objects belongs to current zone.

# File lib/municipitaly/zone.rb, line 22
def regions
  Search.regions_from_zone_code(code)
end