Sha256: e79ee6297237c4ea9092e8a209631dfbec485e265eb1a57075f3ba8bb76f2479
Contents?: true
Size: 1.16 KB
Versions: 4
Compression:
Stored size: 1.16 KB
Contents
# frozen_string_literal: true module Might # Sorting parameter definition # class SortParameterDefinition # @return [String] attr_reader :name # If the property name doesn't match the name in the query string, use the :as option # @return [String] attr_reader :as # @return [Boolean] attr_reader :reverse_direction # @param [String] name of the field # @param [String] as (#name) alias for the property # @param [Boolean] reverse_direction (false) default sorting direction # def initialize(name, as: name, reverse_direction: false) @name = name.to_s @as = as.to_s @reverse_direction = reverse_direction end # If two parameters have the same outer name, they are equal. delegate :hash, to: :as def eql?(other) other.is_a?(self.class) && other.as == as end def ==(other) other.is_a?(self.class) && other.name == name && other.as == as end alias reverse_direction? reverse_direction def validator SortValueValidator.build(self).new end def defined? true end def undefined? !self.defined? end end end
Version data entries
4 entries across 4 versions & 1 rubygems