Method: Neo4j::Wrapper::NodeMixin::ClassMethods#new
- Defined in:
- lib/neo4j-wrapper/node_mixin/class_methods.rb
#new(*args) ⇒ Object Also known as: create
Creates a new node or loads an already existing Neo4j node.
You can use two callback method to initialize the node init_on_load - this method is called when the node is loaded from the database init_on_create - called when the node is created, will be provided with the same argument as the new method
Does
-
sets the neo4j property ‘_classname’ to self.class.to_s
-
creates a neo4j node java object (in @_java_node)
If you want to provide your own initialize method you should instead implement the method init_on_create method.
40 41 42 43 44 45 46 47 |
# File 'lib/neo4j-wrapper/node_mixin/class_methods.rb', line 40 def new(*args) node = Neo4j::Node.create wrapped_node = super() Neo4j::IdentityMap.add(node, wrapped_node) wrapped_node.init_on_load(node) wrapped_node.init_on_create(*args) wrapped_node end |