Class: SortySorter::Params
- Inherits:
-
Object
- Object
- SortySorter::Params
- Defined in:
- lib/sorty_sorter/params.rb
Constant Summary collapse
- DEFAULT_SORT_KEY =
:updated_at
- DEFAULT_SORT_DIR =
:desc
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#defined_cols ⇒ Object
readonly
Returns the value of attribute defined_cols.
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
Instance Method Summary collapse
-
#initialize(col, dir, collection) ⇒ Params
constructor
TODO: Maybe set some default sort columns.
- #options ⇒ Object
- #options! ⇒ Object
Constructor Details
#initialize(col, dir, collection) ⇒ Params
TODO: Maybe set some default sort columns
10 11 12 13 14 15 |
# File 'lib/sorty_sorter/params.rb', line 10 def initialize(col, dir, collection) @column = :"#{col}" @direction = :"#{dir}" @collection = collection @defined_cols = collection.sort_columns end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
3 4 5 |
# File 'lib/sorty_sorter/params.rb', line 3 def collection @collection end |
#column ⇒ Object (readonly)
Returns the value of attribute column.
3 4 5 |
# File 'lib/sorty_sorter/params.rb', line 3 def column @column end |
#defined_cols ⇒ Object (readonly)
Returns the value of attribute defined_cols.
3 4 5 |
# File 'lib/sorty_sorter/params.rb', line 3 def defined_cols @defined_cols end |
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
3 4 5 |
# File 'lib/sorty_sorter/params.rb', line 3 def direction @direction end |
Instance Method Details
#options ⇒ Object
17 18 19 |
# File 'lib/sorty_sorter/params.rb', line 17 def Hash[sort_col, sort_dir] end |
#options! ⇒ Object
21 22 23 |
# File 'lib/sorty_sorter/params.rb', line 21 def Hash[sort_col!, sort_dir!] end |