Class: Haipa::Embedded
- Inherits:
-
Object
- Object
- Haipa::Embedded
- Extended by:
- Forwardable
- Defined in:
- lib/haipa/embedded.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
(also: #to_hash)
readonly
Returns the value of attribute data.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Instance Method Summary collapse
-
#initialize(resource, data) ⇒ Embedded
constructor
A new instance of Embedded.
- #method_missing(name, *args, &block) ⇒ Object
Constructor Details
#initialize(resource, data) ⇒ Embedded
Returns a new instance of Embedded.
9 10 11 12 |
# File 'lib/haipa/embedded.rb', line 9 def initialize(resource, data) @data = data @resource = resource end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/haipa/embedded.rb', line 14 def method_missing(name, *args, &block) name = name.to_s if data.has_key?(name) from_array(data[name]) else super end end |
Instance Attribute Details
#data ⇒ Object (readonly) Also known as: to_hash
Returns the value of attribute data.
5 6 7 |
# File 'lib/haipa/embedded.rb', line 5 def data @data end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
5 6 7 |
# File 'lib/haipa/embedded.rb', line 5 def resource @resource end |