Class: Locomotive::Coal::Resource
- Inherits:
-
Object
- Object
- Locomotive::Coal::Resource
- Defined in:
- lib/locomotive/coal/resource.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Resource
constructor
A new instance of Resource.
- #method_missing(name, *args) ⇒ Object
- #respond_to?(name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(attributes) ⇒ Resource
Returns a new instance of Resource.
7 8 9 |
# File 'lib/locomotive/coal/resource.rb', line 7 def initialize(attributes) @attributes = attributes end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/locomotive/coal/resource.rb', line 11 def method_missing(name, *args) if self.attributes.key?(name.to_s) self.attributes[name.to_s] else super end end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/locomotive/coal/resource.rb', line 5 def attributes @attributes end |
Instance Method Details
#respond_to?(name, include_private = false) ⇒ Boolean
19 20 21 |
# File 'lib/locomotive/coal/resource.rb', line 19 def respond_to?(name, include_private = false) self.attributes.key?(name.to_s) || super end |