Class: Neo4j::Http::ObjectWrapper
- Inherits:
-
Object
- Object
- Neo4j::Http::ObjectWrapper
- Defined in:
- lib/neo4j/http/object_wrapper.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#key_name ⇒ Object
readonly
Returns the value of attribute key_name.
-
#key_value ⇒ Object
readonly
Returns the value of attribute key_value.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#original_attributes ⇒ Object
readonly
Returns the value of attribute original_attributes.
Instance Method Summary collapse
-
#initialize(label:, primary_key_name: nil, **attributes) ⇒ ObjectWrapper
constructor
A new instance of ObjectWrapper.
- #method_missing(method_name, *args, &block) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(label:, primary_key_name: nil, **attributes) ⇒ ObjectWrapper
Returns a new instance of ObjectWrapper.
12 13 14 15 16 17 |
# File 'lib/neo4j/http/object_wrapper.rb', line 12 def initialize(label:, primary_key_name: nil, **attributes) @original_attributes = (attributes || {}).with_indifferent_access @attributes = original_attributes.dup.with_indifferent_access @key_name = primary_key_name @label = label end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/neo4j/http/object_wrapper.rb', line 21 def method_missing(method_name, *args, &block) if @original_attributes.has_key?(method_name) original_attributes[method_name] else super end end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/neo4j/http/object_wrapper.rb', line 6 def attributes @attributes end |
#key_name ⇒ Object (readonly)
Returns the value of attribute key_name.
6 7 8 |
# File 'lib/neo4j/http/object_wrapper.rb', line 6 def key_name @key_name end |
#key_value ⇒ Object (readonly)
Returns the value of attribute key_value.
6 7 8 |
# File 'lib/neo4j/http/object_wrapper.rb', line 6 def key_value @key_value end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
6 7 8 |
# File 'lib/neo4j/http/object_wrapper.rb', line 6 def label @label end |
#original_attributes ⇒ Object (readonly)
Returns the value of attribute original_attributes.
6 7 8 |
# File 'lib/neo4j/http/object_wrapper.rb', line 6 def original_attributes @original_attributes end |
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
29 30 31 |
# File 'lib/neo4j/http/object_wrapper.rb', line 29 def respond_to_missing?(method_name, include_private = false) @original_attributes.has_key?(method_name) || super end |