Class: OrderBy

Inherits:
Object show all
Defined in:
lib/linqr.rb

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ OrderBy

Returns a new instance of OrderBy.



21
22
23
# File 'lib/linqr.rb', line 21

def initialize(node)
  @node = node
end

Instance Method Details

#descending?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/linqr.rb', line 29

def descending?
  last_arg.is_a? Ruby::Hash
end

#expressionsObject



25
26
27
# File 'lib/linqr.rb', line 25

def expressions
  descending?? (@node.arguments[0...-1] << last_arg.first.key): @node.arguments
end

#last_argObject



33
34
35
# File 'lib/linqr.rb', line 33

def last_arg
  @node.arguments.last.arg
end