Class: SortableTable::SortColumn
- Inherits:
-
Object
- Object
- SortableTable::SortColumn
- Defined in:
- lib/sortable_table/models/sort_column.rb
Constant Summary collapse
- SORT_DIRECTIONS =
%w(asc desc)
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
Instance Method Summary collapse
-
#initialize(sort_column, sort_direction, options = {}) ⇒ SortColumn
constructor
A new instance of SortColumn.
Constructor Details
#initialize(sort_column, sort_direction, options = {}) ⇒ SortColumn
Returns a new instance of SortColumn.
6 7 8 9 10 |
# File 'lib/sortable_table/models/sort_column.rb', line 6 def initialize(sort_column, sort_direction, = {}) @column = sort_column @direction = SORT_DIRECTIONS.include?(sort_direction) ? sort_direction : 'asc' @order = [:order] || "#{column} #{direction}" end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
4 5 6 |
# File 'lib/sortable_table/models/sort_column.rb', line 4 def column @column end |
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
4 5 6 |
# File 'lib/sortable_table/models/sort_column.rb', line 4 def direction @direction end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
4 5 6 |
# File 'lib/sortable_table/models/sort_column.rb', line 4 def order @order end |