Class: Songdrop::Collection

Inherits:
Array
  • Object
show all
Defined in:
lib/songdrop/objects/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#_propertiesObject (readonly)

Returns the value of attribute _properties.



3
4
5
# File 'lib/songdrop/objects/collection.rb', line 3

def _properties
  @_properties
end