Module: Sort::NextDirectionForHelper
- Included in:
- ActionSet::Helpers::HelperMethods
- Defined in:
- lib/action_set/helpers/sort/next_direction_for_helper.rb
Instance Method Summary collapse
Instance Method Details
#next_sort_direction_for(attribute, format: :short) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/action_set/helpers/sort/next_direction_for_helper.rb', line 7 def next_sort_direction_for(attribute, format: :short) direction = current_sort_direction_for(attribute) return _ascending(format) unless direction return _ascending(format) unless direction.presence_in %w[asc desc ascending descending] return _ascending(format) if direction.presence_in %w[desc descending] return _descending(format) if direction.presence_in %w[asc ascending] end |