Class: Module::ConjunctiveType

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



125
126
127
# File 'lib/composite_type.rb', line 125

def === x
   @_t[0] === x and @_t[1] === x
end

#>=(t) ⇒ Object



129
130
131
132
133
134
135
136
137
138
# File 'lib/composite_type.rb', line 129

def >= t
  case
  when super
    true
  when t.is_a?(self.class)
    t._t.all?{|e2| @_t.all?{|e1| e1 >= e2}}
  else
    @_t.all?{|e1| e1 >= t}
  end
end

#to_sObject



140
141
142
# File 'lib/composite_type.rb', line 140

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