Class: ItunesSearch::Result
- Inherits:
-
Object
- Object
- ItunesSearch::Result
- Defined in:
- lib/itunes-search/result.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Result
constructor
A new instance of Result.
- #method_missing(method_name, *args) ⇒ Object
- #original_method_missing ⇒ Object
Constructor Details
#initialize(hash) ⇒ Result
Returns a new instance of Result.
6 7 8 9 |
# File 'lib/itunes-search/result.rb', line 6 def initialize(hash) self.attributes = {} self.attributes.merge!(hash) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/itunes-search/result.rb', line 11 def method_missing(method_name,*args) if self.attributes.keys.include?(method_name.to_s) return self.attributes["#{method_name.to_s}"] else original_method_missing method_name, args end end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/itunes-search/result.rb', line 4 def attributes @attributes end |
Instance Method Details
#original_method_missing ⇒ Object
5 |
# File 'lib/itunes-search/result.rb', line 5 alias :original_method_missing :method_missing |