Class: Wreckster::Object
- Inherits:
-
Object
- Object
- Wreckster::Object
- Defined in:
- lib/wreckster/object.rb
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#rank ⇒ Object
readonly
Returns the value of attribute rank.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(traversal, properties) ⇒ Object
constructor
A new instance of Object.
- #method_missing(key, *args) ⇒ Object
- #respond_to?(key) ⇒ Boolean
Constructor Details
#initialize(traversal, properties) ⇒ Object
Returns a new instance of Object.
5 6 7 8 9 10 11 |
# File 'lib/wreckster/object.rb', line 5 def initialize traversal, properties @traversal = traversal @properties = properties @identifier = properties['_id'] @rank = properties[traversal] @type = properties['type'] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(key, *args) ⇒ Object
17 18 19 20 |
# File 'lib/wreckster/object.rb', line 17 def method_missing key, *args return super unless respond_to? key @properties[key.to_s] end |
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
3 4 5 |
# File 'lib/wreckster/object.rb', line 3 def identifier @identifier end |
#rank ⇒ Object (readonly)
Returns the value of attribute rank.
3 4 5 |
# File 'lib/wreckster/object.rb', line 3 def rank @rank end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/wreckster/object.rb', line 3 def type @type end |
Instance Method Details
#respond_to?(key) ⇒ Boolean
13 14 15 |
# File 'lib/wreckster/object.rb', line 13 def respond_to? key @properties.key?(key.to_s) || super end |