class ROM::Neo4j::Commands::CreateNode
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.
@example
class CreateCity < ROM::Commands::Create[:neo4j] input Hash labels :City result :one end
Public Class Methods
options()
click to toggle source
Calls superclass method
# File lib/rom/neo4j/commands.rb, line 22 def self.options super.merge!(labels: labels) end
Public Instance Methods
create_node(properties, labels)
click to toggle source
# 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)
click to toggle source
# 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