Class: Neo4j::Core::Cypher::Expression
- Inherits:
-
Object
- Object
- Neo4j::Core::Cypher::Expression
- Defined in:
- lib/neo4j-core/cypher/cypher.rb
Instance Attribute Summary collapse
-
#clause ⇒ Object
Returns the value of attribute clause.
-
#expressions ⇒ Object
readonly
Returns the value of attribute expressions.
-
#separator ⇒ Object
Returns the value of attribute separator.
Instance Method Summary collapse
-
#initialize(expressions, clause) ⇒ Expression
constructor
A new instance of Expression.
- #insert_last(clause) ⇒ Object
- #prefix ⇒ Object
- #prefixes ⇒ Object
- #valid? ⇒ Boolean
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
#clause ⇒ Object
Returns the value of attribute clause.
206 207 208 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 206 def clause @clause end |
#expressions ⇒ Object (readonly)
Returns the value of attribute expressions.
205 206 207 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 205 def expressions @expressions end |
#separator ⇒ Object
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 |
#prefix ⇒ Object
229 230 231 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 229 def prefix prefixes[clause] end |
#prefixes ⇒ Object
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
233 234 235 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 233 def valid? true end |