Class: Pilipinas::Region

Inherits:
Base
  • Object
show all
Defined in:
lib/pilipinas/region.rb

Overview

Represents one of the 17 administrative regions of the Philippines.

Each Region is the top-level geographic division and contains one or more Province records.

Examples:

region = Pilipinas::Region.find_by(name: "REGION V (Bicol Region)")
region.provinces  # => [#<Province ...>, ...]

Instance Attribute Summary

Attributes inherited from Base

#code, #name

Instance Method Summary collapse

Methods inherited from Base

#==, all, assoc_collection, count, find_by, find_by_code, find_by_name, first, #hash, #initialize, #inspect, last, method_missing, reset_cache, respond_to_missing?, #to_s

Constructor Details

This class inherits a constructor from Pilipinas::Base

Instance Method Details

#provincesArray<Province>

Returns the provinces belonging to this region.

Results are cached after the first call.

Returns:



19
20
21
# File 'lib/pilipinas/region.rb', line 19

def provinces
  Province.assoc_collection(code: code, dir: :regions)
end