Class: ActiveMapper::Adapter::ActiveRecord::Order::Attribute
- Inherits:
-
Object
- Object
- ActiveMapper::Adapter::ActiveRecord::Order::Attribute
- Defined in:
- lib/active_mapper/adapter/active_record/order/attribute.rb
Instance Method Summary collapse
- #-@ ⇒ Object
-
#initialize(name) ⇒ Attribute
constructor
A new instance of Attribute.
- #reverse ⇒ Object
- #to_sql ⇒ Object
Constructor Details
#initialize(name) ⇒ Attribute
Returns a new instance of Attribute.
6 7 8 9 |
# File 'lib/active_mapper/adapter/active_record/order/attribute.rb', line 6 def initialize(name) @name = name @direction = :asc end |
Instance Method Details
#-@ ⇒ Object
11 12 13 14 |
# File 'lib/active_mapper/adapter/active_record/order/attribute.rb', line 11 def -@ @direction = :desc self end |
#reverse ⇒ Object
16 17 18 19 |
# File 'lib/active_mapper/adapter/active_record/order/attribute.rb', line 16 def reverse @direction = asc? ? :desc : :asc self end |
#to_sql ⇒ Object
21 22 23 |
# File 'lib/active_mapper/adapter/active_record/order/attribute.rb', line 21 def to_sql { @name => @direction } end |