Class: Module::ContainerType

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

Constant Summary

Constants inherited from CompositeType

Module::CompositeType::CACHE, Module::CompositeType::CACHE_MUTEX

Constants inherited from Module

Void

Instance Attribute Summary

Attributes inherited from CompositeType

#_t

Instance Method Summary collapse

Methods inherited from CompositeType

#initialize, #name, new_cached

Methods inherited from Module

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

Constructor Details

This class inherits a constructor from Module::CompositeType

Instance Method Details

#===(x) ⇒ Object



38
39
40
# File 'lib/composite_type.rb', line 38

def === x
  @_t[0] === x and x.all?{|e| @_t[1] === e }
end

#>=(t) ⇒ Object



42
43
44
45
# File 'lib/composite_type.rb', line 42

def >= t
  super or
    t.is_a?(self.class) and @_t.zip(t._t).all?{|e1, e2| e1 >= e2 }
end

#to_sObject



47
48
49
# File 'lib/composite_type.rb', line 47

def to_s
  @to_s ||= "#{@_t[0]}.of(#{@_t[1]})".freeze
end