class Municipitaly::Province

Define data structure for a Province

Attributes

acronym[R]
istat[R]
name[R]
region_istat[R]

Public Class Methods

all() click to toggle source

returns an array of all Municipitaly::Province objects.

# File lib/municipitaly/province.rb, line 21
def self.all
  data.provinces
end
new(region_istat:, name:, istat:, acronym:) click to toggle source
# File lib/municipitaly/province.rb, line 11
def initialize(region_istat:, name:, istat:, acronym:)
  @region_istat = region_istat
  @name = name
  @istat = istat
  @acronym = acronym
end

Public Instance Methods

iso3166()
Alias for: iso3166_2
iso3166_2() click to toggle source

returns ISO 3166-2 code for current province.

# File lib/municipitaly/province.rb, line 32
def iso3166_2
  "IT-#{acronym}"
end
Also aliased as: iso3166
municipalities() click to toggle source

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

# File lib/municipitaly/province.rb, line 27
def municipalities
  @municipalities ||= Search.municipalities_from_province_istat(istat)
end