Class: Neo4j::Cypher::CreatePath
- Inherits:
-
Object
- Object
- Neo4j::Cypher::CreatePath
- Includes:
- Clause
- Defined in:
- lib/neo4j-cypher/create.rb
Defined Under Namespace
Classes: EvalContext
Constant Summary
Constants included from Clause
Neo4j::Cypher::Clause::NAME, Neo4j::Cypher::Clause::ORDER
Instance Attribute Summary collapse
-
#arg_list ⇒ Object
readonly
Returns the value of attribute arg_list.
Attributes included from Clause
#clause_list, #clause_type, #eval_context, #expr, #insert_order
Instance Method Summary collapse
-
#initialize(clause_list, *args, &cypher_dsl) ⇒ CreatePath
constructor
A new instance of CreatePath.
- #to_cypher ⇒ Object
- #unique! ⇒ Object
Methods included from Clause
#<=>, #alias_name, #as_alias, #as_alias?, #clause_position, #create_clause_args_for, #match_value, #match_value=, #prefix, #referenced!, #referenced?, #return_value, #separator, #to_prop_string, #valid_clause?, #var_name, #var_name=
Constructor Details
#initialize(clause_list, *args, &cypher_dsl) ⇒ CreatePath
Returns a new instance of CreatePath.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/neo4j-cypher/create.rb', line 80 def initialize(clause_list, *args, &cypher_dsl) super(clause_list, args.empty? ? :create : :with, EvalContext) clause_list.push @args = create_clause_args_for(args) @arg_list = @args.map { |a| a.return_value }.join(',') arg_exec = @args.map(&:eval_context) RootClause::EvalContext.new(self).instance_exec(*arg_exec, &cypher_dsl) @body = "#{clause_list.to_cypher}" clause_list.pop end |
Instance Attribute Details
#arg_list ⇒ Object (readonly)
Returns the value of attribute arg_list.
78 79 80 |
# File 'lib/neo4j-cypher/create.rb', line 78 def arg_list @arg_list end |
Instance Method Details
#to_cypher ⇒ Object
100 101 102 |
# File 'lib/neo4j-cypher/create.rb', line 100 def to_cypher clause_type == :create ? "#{var_name} = #{@body}" : "#{@arg_list} CREATE #{@unique && "UNIQUE "}#{@body}" end |
#unique! ⇒ Object
95 96 97 98 |
# File 'lib/neo4j-cypher/create.rb', line 95 def unique! @unique = true self end |