Class: Neo4j::Cypher::RelVar::EvalContext

Inherits:
Object
  • Object
show all
Includes:
Aggregate, Alias, Context, Returnable, Sortable, Variable
Defined in:
lib/neo4j-cypher/rel_var.rb

Instance Attribute Summary

Attributes included from Context

#clause

Instance Method Summary collapse

Methods included from Context

#clause_list, #initialize

Instance Method Details

#[](p) ⇒ Object



100
101
102
103
104
105
106
# File 'lib/neo4j-cypher/rel_var.rb', line 100

def [](p)
  # TODO
  clause.referenced!
  property = super
  property.clause.match_value = clause.expr
  property
end

#as(name) ⇒ Object

TODO DRY



108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/neo4j-cypher/rel_var.rb', line 108

def as(name) # TODO DRY
  super
  super.tap do
    if clause.match_value == '?'
      clause.match_value = "#{clause.var_name}?"
    elsif clause.match_value.include?(':') || clause.match_value.include?('?')
      clause.match_value = clause.match_value.sub(/[^:\?]*/, clause.var_name.to_s)
    else
      clause.match_value = clause.var_name.to_s
    end
  end
end

#nullObject

generates a is null cypher fragment.



94
95
96
97
# File 'lib/neo4j-cypher/rel_var.rb', line 94

def null
  clause.referenced!
  Operator.new(clause_list, self, nil, '', :where, " is null").unary!
end

#rel_typeObject



74
75
76
# File 'lib/neo4j-cypher/rel_var.rb', line 74

def rel_type
  Property.new(clause, 'type').to_function!
end

#where(&block) ⇒ Object



79
80
81
82
83
84
# File 'lib/neo4j-cypher/rel_var.rb', line 79

def where(&block)
  x = block.call(self)
  clause_list.delete(x)
  Operator.new(clause_list, x.clause, nil, "").unary!
  self
end

#where_not(&block) ⇒ Object



86
87
88
89
90
91
# File 'lib/neo4j-cypher/rel_var.rb', line 86

def where_not(&block)
  x = block.call(self)
  clause_list.delete(x)
  Operator.new(clause_list, x.clause, nil, "not").unary!
  self
end