Class: Neo4j::Cypher::MatchStart::RelLeftMatchContext

Inherits:
Object
  • Object
show all
Includes:
Context, MatchContext
Defined in:
lib/neo4j-cypher/match.rb

Instance Attribute Summary

Attributes included from Context

#clause

Instance Method Summary collapse

Methods included from MatchContext

#clause, #convert_create_clauses, #join_previous!, #join_previous?, #length, #nodes, #not, #rels, #to_cypher

Methods included from Context

#clause_list

Constructor Details

#initialize(match_start, from) ⇒ RelLeftMatchContext

Returns a new instance of RelLeftMatchContext.



187
188
189
190
191
# File 'lib/neo4j-cypher/match.rb', line 187

def initialize(match_start, from)
  super(match_start)
  @from = from
  convert_create_clauses(from)
end

Instance Method Details

#-(to) ⇒ Object



222
223
224
225
# File 'lib/neo4j-cypher/match.rb', line 222

def -(to)
  @match_start.match_list.delete(self) # since it is complete now
  RelRightMatchContext.new(@match_start, self, @rel_var, to, :both)
end

#<(to) ⇒ Object



232
233
234
235
# File 'lib/neo4j-cypher/match.rb', line 232

def <(to)
  @match_start.match_list.delete(self)
  RelRightMatchContext.new(@match_start, self, @rel_var, to, :incoming)
end

#>(to) ⇒ Object



227
228
229
230
# File 'lib/neo4j-cypher/match.rb', line 227

def >(to)
  @match_start.match_list.delete(self)
  RelRightMatchContext.new(@match_start, self, @rel_var, to, :outgoing)
end

#match_valueObject



237
238
239
# File 'lib/neo4j-cypher/match.rb', line 237

def match_value
  @from.match_value
end

#set_rel(rel) ⇒ Object



209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/neo4j-cypher/match.rb', line 209

def set_rel(rel)
  return set_rels(rel) if rel.is_a?(Array)

  if rel.is_a?(Neo4j::Cypher::RelVar::EvalContext)
    @rel_var = rel.clause
  elsif rel.respond_to?(:clause) && rel.clause.match_value
    @rel_var = rel.clause
  else
    @rel_var = RelVar.new(clause_list, [rel])
  end
  self
end

#set_rels(rels) ⇒ Object



193
194
195
196
197
198
199
200
201
# File 'lib/neo4j-cypher/match.rb', line 193

def set_rels(rels)
  if rels.size == 1
    set_rel(rels.first)
  else
    # wrap and maybe join several relationship strings
    @rel_var = RelVar.new(clause_list, rels)
  end
  self
end

#set_rels?(rels) ⇒ Boolean

Returns:

  • (Boolean)


203
204
205
206
207
# File 'lib/neo4j-cypher/match.rb', line 203

def set_rels?(rels)
  set_rels(rels)
  @rel_var.optionally!
  self
end