Class: Endymion::Sort
- Inherits:
-
Object
- Object
- Endymion::Sort
- Defined in:
- lib/endymion/sort.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
Instance Method Summary collapse
- #ascending? ⇒ Boolean
- #descending? ⇒ Boolean
-
#initialize(field, order) ⇒ Sort
constructor
A new instance of Sort.
- #to_h ⇒ Object
Constructor Details
#initialize(field, order) ⇒ Sort
Returns a new instance of Sort.
6 7 8 9 |
# File 'lib/endymion/sort.rb', line 6 def initialize(field, order) @field = field @order = order end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
4 5 6 |
# File 'lib/endymion/sort.rb', line 4 def field @field end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
4 5 6 |
# File 'lib/endymion/sort.rb', line 4 def order @order end |
Instance Method Details
#ascending? ⇒ Boolean
11 12 13 |
# File 'lib/endymion/sort.rb', line 11 def ascending? order == :asc end |
#descending? ⇒ Boolean
15 16 17 |
# File 'lib/endymion/sort.rb', line 15 def descending? order == :desc end |
#to_h ⇒ Object
19 20 21 22 23 24 |
# File 'lib/endymion/sort.rb', line 19 def to_h { :field => field, :order => order } end |