Class: Zoid::Resource
- Inherits:
-
Object
- Object
- Zoid::Resource
- Defined in:
- lib/zoid/resource.rb
Instance Method Summary collapse
-
#initialize(hash) ⇒ Resource
constructor
A new instance of Resource.
- #method_missing(method, *args) ⇒ Object
- #respond_to_missing?(method, include_private = false) ⇒ Boolean
Constructor Details
#initialize(hash) ⇒ Resource
Returns a new instance of Resource.
3 4 5 |
# File 'lib/zoid/resource.rb', line 3 def initialize(hash) @attributes = hash end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/zoid/resource.rb', line 11 def method_missing(method, *args) if @attributes.has_key?(method.to_s) @attributes[method.to_s] else super end end |
Instance Method Details
#respond_to_missing?(method, include_private = false) ⇒ Boolean
7 8 9 |
# File 'lib/zoid/resource.rb', line 7 def respond_to_missing?(method, include_private = false) @attributes.has_key?[method.to_s] end |