Class: Neo4j::Core::Cypher::Expression

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4j-core/cypher/cypher.rb

Direct Known Subclasses

ExprOp, Limit, Match, OrderBy, Predicate, Return, Skip, Start, Where

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expressions, clause) ⇒ Expression

Returns a new instance of Expression.



208
209
210
211
212
213
# File 'lib/neo4j-core/cypher/cypher.rb', line 208

def initialize(expressions, clause)
  @clause = clause
  @expressions = expressions
  insert_last(clause)
  @separator = ","
end

Instance Attribute Details

#clauseObject

Returns the value of attribute clause.



206
207
208
# File 'lib/neo4j-core/cypher/cypher.rb', line 206

def clause
  @clause
end

#expressionsObject (readonly)

Returns the value of attribute expressions.



205
206
207
# File 'lib/neo4j-core/cypher/cypher.rb', line 205

def expressions
  @expressions
end

#separatorObject

Returns the value of attribute separator.



206
207
208
# File 'lib/neo4j-core/cypher/cypher.rb', line 206

def separator
  @separator
end

Instance Method Details

#insert_last(clause) ⇒ Object



215
216
217
218
219
220
221
222
223
# File 'lib/neo4j-core/cypher/cypher.rb', line 215

def insert_last(clause)
  i = @expressions.reverse.index { |e| e.clause == clause }
  if i.nil?
    @expressions << self
  else
    pos = @expressions.size - i
    @expressions.insert(pos, self)
  end
end

#prefixObject



229
230
231
# File 'lib/neo4j-core/cypher/cypher.rb', line 229

def prefix
  prefixes[clause]
end

#prefixesObject



225
226
227
# File 'lib/neo4j-core/cypher/cypher.rb', line 225

def prefixes
  {:start => "START", :where => " WHERE", :match => " MATCH", :return => " RETURN", :order_by => " ORDER BY", :skip => " SKIP", :limit => " LIMIT"}
end

#valid?Boolean

Returns:

  • (Boolean)


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

def valid?
  true
end