Class: SortableColumns::ColumnSorter
- Inherits:
-
Object
- Object
- SortableColumns::ColumnSorter
- Defined in:
- lib/sortable_columns/column_sorter.rb
Instance Attribute Summary collapse
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Instance Method Summary collapse
- #column(column = nil) ⇒ Object
- #direction(direction = nil) ⇒ Object
-
#initialize(resource) ⇒ ColumnSorter
constructor
A new instance of ColumnSorter.
Constructor Details
#initialize(resource) ⇒ ColumnSorter
Returns a new instance of ColumnSorter.
5 6 7 |
# File 'lib/sortable_columns/column_sorter.rb', line 5 def initialize(resource) @resource = resource end |
Instance Attribute Details
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
3 4 5 |
# File 'lib/sortable_columns/column_sorter.rb', line 3 def resource @resource end |
Instance Method Details
#column(column = nil) ⇒ Object
9 10 11 12 |
# File 'lib/sortable_columns/column_sorter.rb', line 9 def column(column=nil) return SortableColumns.config.default_sort_column if column.nil? sanitize_column(column) || SortableColumns.config.default_sort_column end |
#direction(direction = nil) ⇒ Object
14 15 16 17 |
# File 'lib/sortable_columns/column_sorter.rb', line 14 def direction(direction=nil) return SortableColumns.config.default_sort_direction if direction.nil? sanitize_direction(direction) || SortableColumns.config.default_sort_direction end |