Class: Might::SortParameterDefinition
- Inherits:
-
Object
- Object
- Might::SortParameterDefinition
- Defined in:
- lib/might/sort_parameter_definition.rb
Overview
Sorting parameter definition
Direct Known Subclasses
Instance Attribute Summary collapse
-
#as ⇒ String
readonly
If the property name doesn’t match the name in the query string, use the :as option.
- #name ⇒ String readonly
- #reverse_direction ⇒ Boolean (also: #reverse_direction?) readonly
Instance Method Summary collapse
- #==(other) ⇒ Object
- #defined? ⇒ Boolean
- #eql?(other) ⇒ Boolean
-
#initialize(name, as: name, reverse_direction: false) ⇒ SortParameterDefinition
constructor
A new instance of SortParameterDefinition.
- #undefined? ⇒ Boolean
- #validator ⇒ Object
Constructor Details
#initialize(name, as: name, reverse_direction: false) ⇒ SortParameterDefinition
Returns a new instance of SortParameterDefinition.
20 21 22 23 24 |
# File 'lib/might/sort_parameter_definition.rb', line 20 def initialize(name, as: name, reverse_direction: false) @name = name.to_s @as = as.to_s @reverse_direction = reverse_direction end |
Instance Attribute Details
#as ⇒ String (readonly)
If the property name doesn’t match the name in the query string, use the :as option
11 12 13 |
# File 'lib/might/sort_parameter_definition.rb', line 11 def as @as end |
#name ⇒ String (readonly)
7 8 9 |
# File 'lib/might/sort_parameter_definition.rb', line 7 def name @name end |
#reverse_direction ⇒ Boolean (readonly) Also known as: reverse_direction?
14 15 16 |
# File 'lib/might/sort_parameter_definition.rb', line 14 def reverse_direction @reverse_direction end |
Instance Method Details
#==(other) ⇒ Object
33 34 35 36 37 |
# File 'lib/might/sort_parameter_definition.rb', line 33 def ==(other) other.is_a?(self.class) && other.name == name && other.as == as end |
#defined? ⇒ Boolean
45 46 47 |
# File 'lib/might/sort_parameter_definition.rb', line 45 def defined? true end |
#eql?(other) ⇒ Boolean
29 30 31 |
# File 'lib/might/sort_parameter_definition.rb', line 29 def eql?(other) other.is_a?(self.class) && other.as == as end |
#undefined? ⇒ Boolean
49 50 51 |
# File 'lib/might/sort_parameter_definition.rb', line 49 def undefined? !self.defined? end |
#validator ⇒ Object
41 42 43 |
# File 'lib/might/sort_parameter_definition.rb', line 41 def validator SortValueValidator.build(self).new end |