Class: ActiveEnumerable::Order::DESC

Inherits:
Object
  • Object
show all
Defined in:
lib/active_enumerable/order.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(r) ⇒ DESC

Returns a new instance of DESC.



39
40
41
# File 'lib/active_enumerable/order.rb', line 39

def initialize(r)
  @r = r
end

Instance Attribute Details

#rObject (readonly)

Returns the value of attribute r.



37
38
39
# File 'lib/active_enumerable/order.rb', line 37

def r
  @r
end

Instance Method Details

#<=>(other) ⇒ Object



43
44
45
# File 'lib/active_enumerable/order.rb', line 43

def <=>(other)
  -(r <=> other.r) # Flip negative/positive result
end