Class: Arel::Nodes::Ascending

Inherits:
Ordering
  • Object
show all
Defined in:
ext/arel/nodes/ascending.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expr, nulls = nil) ⇒ Ascending

Returns a new instance of Ascending.



7
8
9
10
# File 'ext/arel/nodes/ascending.rb', line 7

def initialize expr, nulls=nil
  super(expr)
  @nulls = nulls
end

Instance Attribute Details

#nullsObject

Returns the value of attribute nulls.



5
6
7
# File 'ext/arel/nodes/ascending.rb', line 5

def nulls
  @nulls
end

Instance Method Details

#reverseObject



12
13
14
15
16
17
18
19
20
21
22
# File 'ext/arel/nodes/ascending.rb', line 12

def reverse
  reverse_nulls = if nulls == :nulls_first
    :nulls_last
  elsif nulls
    :nulls_first
  else
    nil
  end
  
  Descending.new(expr, reverse_nulls)
end