Class: Songdrop::Collection
- Inherits:
-
Array
- Object
- Array
- Songdrop::Collection
- Defined in:
- lib/songdrop/objects/collection.rb
Instance Attribute Summary collapse
-
#_properties ⇒ Object
readonly
Returns the value of attribute _properties.
Instance Method Summary collapse
-
#initialize(properties = {}) ⇒ Collection
constructor
A new instance of Collection.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(properties = {}) ⇒ Collection
5 6 7 |
# File 'lib/songdrop/objects/collection.rb', line 5 def initialize(properties={}) @_properties = properties end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/songdrop/objects/collection.rb', line 9 def method_missing(method, *args, &block) method = $1 if method =~ /(\S+)\?/ method = method.to_s return @_properties[method] if @_properties.has_key?(method) method = method.to_sym # super requires a symbol super end |
Instance Attribute Details
#_properties ⇒ Object (readonly)
Returns the value of attribute _properties.
3 4 5 |
# File 'lib/songdrop/objects/collection.rb', line 3 def _properties @_properties end |