Class: ROM::Neo4j::Commands::CreateNode
- Inherits:
-
Commands::Create
- Object
- Commands::Create
- ROM::Neo4j::Commands::CreateNode
- Defined in:
- lib/rom/neo4j/commands.rb
Overview
Creates a new node
Creates a new node in the graph with given properties. Any labels configured on the command will also be applied to the node.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.options ⇒ Object
22 23 24 |
# File 'lib/rom/neo4j/commands.rb', line 22 def self. super.merge!(labels: labels) end |
Instance Method Details
#create_node(properties, labels) ⇒ Object
33 34 35 36 |
# File 'lib/rom/neo4j/commands.rb', line 33 def create_node(properties, labels) result = relation.dataset.session.create_node(properties, labels) result.props end |
#execute(properties) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/rom/neo4j/commands.rb', line 26 def execute(properties) node_args = [properties] node_args << [labels].flatten if labels create_node(*node_args) end |