Class: Wallaby::Sorting::NextBuilder
- Inherits:
-
Object
- Object
- Wallaby::Sorting::NextBuilder
- Defined in:
- lib/services/wallaby/sorting/next_builder.rb
Overview
Generate sort param for given field’s next sort order (e.g. from empty to ‘asc`, from `asc` to `desc`, from `desc` to empty)
Direct Known Subclasses
Constant Summary collapse
- ASC =
'asc'
- DESC =
'desc'
Instance Method Summary collapse
-
#initialize(params, hash = nil) ⇒ NextBuilder
constructor
A new instance of NextBuilder.
-
#next_params(field_name) ⇒ ActionController::Parameters
Update the ‘sort` parameter.
Constructor Details
#initialize(params, hash = nil) ⇒ NextBuilder
Returns a new instance of NextBuilder.
13 14 15 16 |
# File 'lib/services/wallaby/sorting/next_builder.rb', line 13 def initialize(params, hash = nil) @params = params @hash = hash.try(:with_indifferent_access) || HashBuilder.build(params[:sort]) end |