class Neo4j::Cypher::OrderBy

Public Class Methods

new(clause_list, context) click to toggle source
Calls superclass method Neo4j::Cypher::Clause::new
   # File lib/neo4j-cypher/return.rb
36 def initialize(clause_list, context)
37   super(clause_list, :order_by, context)
38   @orders = []
39 end

Public Instance Methods

asc(props) click to toggle source
   # File lib/neo4j-cypher/return.rb
41 def asc(props)
42   @orders << [:asc, props.map(&:clause)]
43 end
desc(props) click to toggle source
   # File lib/neo4j-cypher/return.rb
45 def desc(props)
46   @orders << [:desc, props.map(&:clause)]
47 end
to_cypher() click to toggle source
   # File lib/neo4j-cypher/return.rb
49 def to_cypher
50   @orders.map do |pair|
51     if pair[0] == :asc
52       pair[1].map{|p| p.alias_name || p.return_value}.join(', ')
53     else
54       pair[1].map{|p| p.alias_name || p.return_value}.join(', ') + " DESC"
55     end
56   end.join(', ')
57 end