Class: SAU::Regions
- Inherits:
-
Object
- Object
- SAU::Regions
- Defined in:
- lib/sau/regions.rb
Instance Attribute Summary collapse
-
#regions ⇒ Object
readonly
Returns the value of attribute regions.
Instance Method Summary collapse
-
#initialize(regions) ⇒ Regions
constructor
A new instance of Regions.
- #method_missing(meth, *args) ⇒ Object
Constructor Details
#initialize(regions) ⇒ Regions
Returns a new instance of Regions.
5 6 7 |
# File 'lib/sau/regions.rb', line 5 def initialize(regions) @regions = regions end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
9 10 11 12 13 |
# File 'lib/sau/regions.rb', line 9 def method_missing(meth, *args) super(meth, args) unless meth.to_s =~ /^get_by_(\w+)$/ value, prop = args.first, $1 @regions.find { |region| region.send(prop.to_sym) == value } end |
Instance Attribute Details
#regions ⇒ Object (readonly)
Returns the value of attribute regions.
3 4 5 |
# File 'lib/sau/regions.rb', line 3 def regions @regions end |