class Cuprum::Collections::Constraints::Order::SortDirection

Asserts that the object is a valid direction for a sort.

Constants

NEGATED_TYPE

The :type of the error generated for a matching object.

TYPE

The :type of the error generated for a non-matching object.

Public Class Methods

instance() click to toggle source

@return [Cuprum::Collections::Constraints::AttributeName] a cached

instance of the constraint with default options.
# File lib/cuprum/collections/constraints/order/sort_direction.rb, line 18
def self.instance
  @instance ||= new
end
new(**options) click to toggle source
Calls superclass method
# File lib/cuprum/collections/constraints/order/sort_direction.rb, line 22
def initialize(**options)
  super(*sort_directions, **options)
end

Private Instance Methods

sort_directions() click to toggle source
# File lib/cuprum/collections/constraints/order/sort_direction.rb, line 28
def sort_directions
  %w[asc ascending desc descending] + %i[asc ascending desc descending]
end