Method: Uinit::Type::HashOf#initialize

Defined in:
lib/uinit/type/hash_of.rb

#initialize(schema, strict: false) ⇒ HashOf

Returns a new instance of HashOf.

Raises:

  • (ArgumentError)


14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/uinit/type/hash_of.rb', line 14

def initialize(schema, strict: false)
  super()

  raise ArgumentError, 'schema must be a Hash' unless self.class.from?(schema)

  @schema =
    schema.transform_values do |type|
      Type.from(type)
    end

  @strict = !!strict
end