Class: Neo4j::Cypher::NodeVar

Inherits:
Object
  • Object
show all
Includes:
Clause
Defined in:
lib/neo4j-cypher/node_var.rb

Overview

Represents an unbound node variable used in match statements

Defined Under Namespace

Classes: EvalContext

Constant Summary

Constants included from Clause

Clause::NAME, Clause::ORDER

Instance Attribute Summary

Attributes included from Clause

#clause_list, #clause_type, #eval_context, #insert_order

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Clause

#<=>, #alias_name, #as_alias, #as_alias?, #clause_position, #create_clause_args_for, #match_value, #match_value=, #prefix, #referenced!, #referenced?, #separator, #to_prop_string, #valid_clause?, #var_name, #var_name=

Constructor Details

#initialize(clause_list, var_name = nil) ⇒ NodeVar

Returns a new instance of NodeVar.



8
9
10
11
# File 'lib/neo4j-cypher/node_var.rb', line 8

def initialize(clause_list, var_name = nil)
  super(clause_list, :node_var, EvalContext)
  @var_name = var_name
end

Class Method Details

.as_var(clause_list, something) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/neo4j-cypher/node_var.rb', line 13

def self.as_var(clause_list, something)
  if something.is_a?(Symbol) || something.is_a?(String)
    NodeVar.new(clause_list, something)
  elsif something.respond_to?(:clause)
    something.clause
  else
    something
  end
end

Instance Method Details

#exprObject



23
24
25
# File 'lib/neo4j-cypher/node_var.rb', line 23

def expr
  var_name
end

#return_valueObject



32
33
34
# File 'lib/neo4j-cypher/node_var.rb', line 32

def return_value
  to_cypher
end

#to_cypherString

Returns a cypher string for this node variable.

Returns:

  • (String)

    a cypher string for this node variable



28
29
30
# File 'lib/neo4j-cypher/node_var.rb', line 28

def to_cypher
  var_name
end