Module: Neo4j::Wrapper::NodeMixin::Initialize
- Included in:
- NodeMixin
- Defined in:
- lib/neo4j-wrapper/node_mixin/initialize.rb
Instance Method Summary collapse
-
#_java_node ⇒ Neo4j::Node
(also: #_java_entity)
Returns the org.neo4j.graphdb.Node wrapped object.
-
#init_on_create(*args) ⇒ Object
Creates a new node and initialize with given properties.
-
#init_on_load(java_node) ⇒ Object
Init this node with the specified java neo node.
-
#wrapper ⇒ Object
Implements the Neo4j::Node#wrapper and Neo4j::Relationship#wrapper method so that we don’t have to care if the node is wrapped or not.
Instance Method Details
#_java_node ⇒ Neo4j::Node Also known as: _java_entity
Returns the org.neo4j.graphdb.Node wrapped object
26 27 28 |
# File 'lib/neo4j-wrapper/node_mixin/initialize.rb', line 26 def _java_node @_java_node end |
#init_on_create(*args) ⇒ Object
Creates a new node and initialize with given properties. You can override this to provide your own initialization.
17 18 19 20 21 22 |
# File 'lib/neo4j-wrapper/node_mixin/initialize.rb', line 17 def init_on_create(*args) _java_entity[:_classname] = self.class.to_s if args[0].respond_to?(:each_pair) args[0].each_pair { |k, v| respond_to?("#{k}=") ? self.send("#{k}=", v) : _java_entity[k] = v } end end |
#init_on_load(java_node) ⇒ Object
Init this node with the specified java neo node
8 9 10 |
# File 'lib/neo4j-wrapper/node_mixin/initialize.rb', line 8 def init_on_load(java_node) @_java_node = java_node end |
#wrapper ⇒ Object
Implements the Neo4j::Node#wrapper and Neo4j::Relationship#wrapper method so that we don’t have to care if the node is wrapped or not.
33 34 35 |
# File 'lib/neo4j-wrapper/node_mixin/initialize.rb', line 33 def wrapper self end |