Class: PSGC::ProvinceOrDistrict

Inherits:
Struct
  • Object
show all
Defined in:
lib/psgc/province.rb

Direct Known Subclasses

District, Province

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



2
3
4
# File 'lib/psgc/province.rb', line 2

def id
  @id
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



2
3
4
# File 'lib/psgc/province.rb', line 2

def name
  @name
end

Instance Method Details

#citiesObject



10
11
12
# File 'lib/psgc/province.rb', line 10

def cities
  @cities ||= load(cities_data, PSGC::City) || []
end

#codeObject



3
4
5
# File 'lib/psgc/province.rb', line 3

def code
  "#{id}00000"
end

#municipalitiesObject



14
15
16
# File 'lib/psgc/province.rb', line 14

def municipalities
  @municipalities ||= load(municipalities_data, PSGC::Municipality) || []
end

#province?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/psgc/province.rb', line 6

def province?
  is_a? Province
end