Class: PhilLocator::Region

Inherits:
ActiveYaml::Base
  • Object
show all
Includes:
ActiveHash::Associations
Defined in:
app/models/phil_locator/region.rb

Instance Method Summary collapse

Instance Method Details

#aliasObject



12
13
14
# File 'app/models/phil_locator/region.rb', line 12

def alias
  self[:name].split("(").last.strip.gsub(/\(|\)/, "")
end

#citiesObject



16
17
18
# File 'app/models/phil_locator/region.rb', line 16

def cities
  PhilLocator::City.where(province_code: provinces.map(&:province_code))
end

#municipalitiesObject



20
21
22
# File 'app/models/phil_locator/region.rb', line 20

def municipalities
  PhilLocator::Municipality.where(province_code: provinces.map(&:province_code))
end

#nameObject



24
25
26
# File 'app/models/phil_locator/region.rb', line 24

def name
  self[:name].split("(").first.delete("(").strip
end