class Right::SortParameter

User provided filtering on particular parameter

Constants

DIRECTIONS
REVERSED_DIRECTIONS

Attributes

definition[R]

@return [ParameterDefinition]

direction[R]
validator[R]

Public Class Methods

new(direction, definition) click to toggle source

@param ['asc', desc'] direction @param [SortParameterDefinition]

# File lib/right/sort_parameter.rb, line 21
def initialize(direction, definition)
  @direction = direction.to_s
  fail ArgumentError unless DIRECTIONS.include?(@direction)
  @definition = definition
  @validator = definition.validator
end

Public Instance Methods

==(other) click to toggle source
# File lib/right/sort_parameter.rb, line 37
def ==(other)
  is_a?(other.class) &&
    direction == other.direction &&
    definition == other.definition
end
errors() click to toggle source
# File lib/right/sort_parameter.rb, line 33
def errors
  validator.errors.full_messages
end