Method: Jet::Type#initialize

Defined in:
lib/jet/type.rb

#initialize(name, *types, coercions: [], filter: nil, &blk) ⇒ Type

Returns a new instance of Type.



22
23
24
25
26
27
28
29
# File 'lib/jet/type.rb', line 22

def initialize(name, *types, coercions: [], filter: nil, &blk)
  @name = name.to_sym
  @coercions = coercions.dup
  @filter = filter
  @types = Jet.type_check_each!("`types`", types, Class, Module)
  instance_eval(&blk) if block_given?
  @coercions.freeze
end