Class: TypicalSort::Params
- Inherits:
-
Object
- Object
- TypicalSort::Params
- Defined in:
- lib/typical_sort/params.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#default_attribute ⇒ Object
readonly
Returns the value of attribute default_attribute.
-
#default_direction ⇒ Object
readonly
Returns the value of attribute default_direction.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #attribute ⇒ Object
- #direction ⇒ Object
- #explicit? ⇒ Boolean
-
#initialize(params:, configuration:, default_attribute:, default_direction:) ⇒ Params
constructor
A new instance of Params.
Constructor Details
#initialize(params:, configuration:, default_attribute:, default_direction:) ⇒ Params
Returns a new instance of Params.
7 8 9 10 11 12 |
# File 'lib/typical_sort/params.rb', line 7 def initialize(params:, configuration:, default_attribute:, default_direction:) @params = params @configuration = configuration @default_attribute = default_attribute @default_direction = default_direction end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
5 6 7 |
# File 'lib/typical_sort/params.rb', line 5 def configuration @configuration end |
#default_attribute ⇒ Object (readonly)
Returns the value of attribute default_attribute.
5 6 7 |
# File 'lib/typical_sort/params.rb', line 5 def default_attribute @default_attribute end |
#default_direction ⇒ Object (readonly)
Returns the value of attribute default_direction.
5 6 7 |
# File 'lib/typical_sort/params.rb', line 5 def default_direction @default_direction end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
5 6 7 |
# File 'lib/typical_sort/params.rb', line 5 def params @params end |
Instance Method Details
#attribute ⇒ Object
14 15 16 |
# File 'lib/typical_sort/params.rb', line 14 def attribute explicit_attribute || default_attribute end |
#direction ⇒ Object
18 19 20 |
# File 'lib/typical_sort/params.rb', line 18 def direction explicit_direction || normalized_direction(default_direction) || configuration.default_direction end |
#explicit? ⇒ Boolean
22 23 24 |
# File 'lib/typical_sort/params.rb', line 22 def explicit? raw_sort.present? end |