Class: Module::ContainerType

Inherits:
CompositeType show all
Defined in:
lib/typed_attr/composite_type.rb

Instance Method Summary collapse

Methods inherited from CompositeType

#_a, #_b, #initialize

Methods inherited from Module

#&, #of, #with, #|, #~@

Constructor Details

This class inherits a constructor from Module::CompositeType

Instance Method Details

#===(x) ⇒ Object



12
13
14
# File 'lib/typed_attr/composite_type.rb', line 12

def === x
  @a === x and x.all?{|e| @b === e }
end

#to_sObject



15
16
17
# File 'lib/typed_attr/composite_type.rb', line 15

def to_s
  @to_s ||= "#{@a}.of(#{@b})".freeze
end