Module: Neo4j::Cypher::Context::ReturnOrder

Defined in:
lib/neo4j-cypher/context.rb

Instance Method Summary collapse

Instance Method Details

#_sort_args(props) ⇒ Object



181
182
183
184
# File 'lib/neo4j-cypher/context.rb', line 181

def _sort_args(props)
  return [self] if props.empty?
  props.map { |p| p.is_a?(Symbol) ? Property.new(clause, p).eval_context : p }
end

#asc(*props) ⇒ Object

Specifies an ORDER BY cypher query

Parameters:

  • props (Property)

    the properties which should be sorted

Returns:

  • self



189
190
191
192
193
194
# File 'lib/neo4j-cypher/context.rb', line 189

def asc(*props)
  @order_by ||= OrderBy.new(clause_list, self)
  clause_list.delete(props.first)
  @order_by.asc(_sort_args(props))
  self
end

#desc(*props) ⇒ Object

Specifies an ORDER BY cypher query

Parameters:

  • props (Property)

    the properties which should be sorted

Returns:

  • self



199
200
201
202
203
204
# File 'lib/neo4j-cypher/context.rb', line 199

def desc(*props)
  @order_by ||= OrderBy.new(clause_list, self)
  clause_list.delete(props.first)
  @order_by.desc(_sort_args(props))
  self
end

#limit(val) ⇒ Object

Creates a LIMIT cypher clause

Parameters:

  • val (Fixnum)

    the number of entries to limit

Returns:

  • self



217
218
219
220
# File 'lib/neo4j-cypher/context.rb', line 217

def limit(val)
  Limit.new(clause_list, val, self)
  self
end

#skip(val) ⇒ Object

Creates a SKIP cypher clause

Parameters:

  • val (Fixnum)

    the number of entries to skip

Returns:

  • self



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

def skip(val)
  Skip.new(clause_list, val, self)
  self
end