Class: Neo4j::Core::Cypher::Return
- Inherits:
-
Expression
- Object
- Expression
- Neo4j::Core::Cypher::Return
- Defined in:
- lib/neo4j-core/cypher/cypher.rb
Overview
The return statement in the cypher query
Instance Attribute Summary collapse
-
#var_name ⇒ Object
readonly
Returns the value of attribute var_name.
Attributes inherited from Expression
#clause, #expressions, #separator
Instance Method Summary collapse
- #as_return_method ⇒ Object
-
#asc(*props) ⇒ Object
Specifies an
ORDER BY
cypher query. -
#desc(*props) ⇒ Object
Specifies an
ORDER BY
cypher query. -
#initialize(name_or_ref, expressions, opts = {}) ⇒ Return
constructor
A new instance of Return.
-
#limit(val) ⇒ Object
Creates a
LIMIT
cypher clause. - #return_method ⇒ Object
-
#skip(val) ⇒ Object
Creates a
SKIP
cypher clause. - #to_s ⇒ Object
Methods inherited from Expression
#insert_last, #prefix, #prefixes, #prev_clause, #valid?
Constructor Details
#initialize(name_or_ref, expressions, opts = {}) ⇒ Return
Returns a new instance of Return.
437 438 439 440 441 442 443 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 437 def initialize(name_or_ref, expressions, opts = {}) super(expressions, :return) @name_or_ref = name_or_ref @name_or_ref.referenced! if @name_or_ref.respond_to?(:referenced!) @var_name = @name_or_ref.respond_to?(:var_name) ? @name_or_ref.var_name : @name_or_ref.to_s opts.each_pair { |k, v| self.send(k, v) } end |
Instance Attribute Details
#var_name ⇒ Object (readonly)
Returns the value of attribute var_name.
435 436 437 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 435 def var_name @var_name end |
Instance Method Details
#as_return_method ⇒ Object
451 452 453 454 455 456 457 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 451 def as_return_method if return_method[:bracket] "#{return_method[:name]}(#@var_name)" else "#{return_method[:name]} #@var_name" end end |
#asc(*props) ⇒ Object
Specifies an ORDER BY
cypher query
462 463 464 465 466 467 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 462 def asc(*props) @order_by ||= OrderBy.new(expressions) expressions.delete(props.first) @order_by.asc(props) self end |
#desc(*props) ⇒ Object
Specifies an ORDER BY
cypher query
472 473 474 475 476 477 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 472 def desc(*props) @order_by ||= OrderBy.new(expressions) expressions.delete(props.first) @order_by.desc(props) self end |
#limit(val) ⇒ Object
Creates a LIMIT
cypher clause
490 491 492 493 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 490 def limit(val) Limit.new(expressions, val) self end |
#return_method ⇒ Object
446 447 448 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 446 def return_method @name_or_ref.respond_to?(:return_method) && @name_or_ref.return_method end |
#skip(val) ⇒ Object
Creates a SKIP
cypher clause
482 483 484 485 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 482 def skip(val) Skip.new(expressions, val) self end |
#to_s ⇒ Object
495 496 497 |
# File 'lib/neo4j-core/cypher/cypher.rb', line 495 def to_s return_method ? as_return_method : var_name.to_s end |