Class: Cuprum::Collections::Constraints::Order::AttributesHash

Inherits:
Stannum::Constraints::Types::HashType
  • Object
show all
Defined in:
lib/cuprum/collections/constraints/order/attributes_hash.rb

Overview

Asserts that the object is a Hash of attribute names and sort directions.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**options) ⇒ AttributesHash

Returns a new instance of AttributesHash.

Parameters:

  • options (Hash<Symbol, Object>)

    Configuration options for the constraint. Defaults to an empty Hash.



18
19
20
21
22
23
24
25
# File 'lib/cuprum/collections/constraints/order/attributes_hash.rb', line 18

def initialize(**options)
  super(
    key_type:   Cuprum::Collections::Constraints::AttributeName.instance,
    value_type: Cuprum::Collections::Constraints::Order::SortDirection
      .instance,
    **options
  )
end

Class Method Details

.instanceCuprum::Collections::Constraints::Order::AttributesArray

Returns a cached instance of the constraint with default options.

Returns:



12
13
14
# File 'lib/cuprum/collections/constraints/order/attributes_hash.rb', line 12

def self.instance
  @instance ||= new
end