class Neo4j::Cypher::Create

Public Class Methods

new(clause_list, props, labels=nil) click to toggle source
Calls superclass method Neo4j::Cypher::Clause::new
   # File lib/neo4j-cypher/create.rb
36 def initialize(clause_list, props, labels=nil)
37   super(clause_list, :create, EvalContext)
38   @props = props unless props && props.empty?
39   @labels = labels unless labels && labels.empty?
40 end

Public Instance Methods

as_create_path!() click to toggle source
   # File lib/neo4j-cypher/create.rb
46 def as_create_path!
47   @as_create_path = true # this is because create path has a little different syntax (extra parantheses)
48 end
as_create_path?() click to toggle source
   # File lib/neo4j-cypher/create.rb
42 def as_create_path?
43   !!@as_create_path
44 end
match_value() click to toggle source
   # File lib/neo4j-cypher/create.rb
50 def match_value
51   to_cypher
52 end
to_cypher() click to toggle source
   # File lib/neo4j-cypher/create.rb
54 def to_cypher
55   label_suffix = @labels && ":" + @labels.map{|name| "`#{name.to_s}`"}.join(':')
56 
57   without_parantheses = if @props
58                           "#{var_name}#{label_suffix} #{to_prop_string(@props)}"
59                         else
60                           "#{var_name}#{label_suffix}"
61                         end
62 
63   as_create_path? ? without_parantheses : "(#{without_parantheses})"
64 end