class Stannum::Constraints::Types::HashWithSymbolKeys

Asserts that the object is a Hash with Symbol keys.

Public Class Methods

new(value_type: nil, **options) click to toggle source

@param value_type [Stannum::Constraints::Base, Class, nil] If set, then

the constraint will check the types of each value in the Hash against
the expected type and will fail if any values do not match.

@param options [Hash<Symbol, Object>] Configuration options for the

constraint. Defaults to an empty Hash.
# File lib/stannum/constraints/types/hash_with_symbol_keys.rb, line 13
def initialize(value_type: nil, **options)
  super(
    key_type:   Stannum::Constraints::Types::SymbolType.new,
    value_type: coerce_value_type(value_type),
    **options
  )
end