Class: Module::NegativeType

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

Constant Summary collapse

INVERSE_MAP =
{
}

Constants inherited from CompositeType

CompositeType::CACHE, CompositeType::CACHE_MUTEX

Constants inherited from Module

Void

Instance Attribute Summary

Attributes inherited from CompositeType

#_t

Class Method Summary collapse

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

Class Method Details

.inverse(a, b) ⇒ Object



175
176
177
178
# File 'lib/composite_type.rb', line 175

def self.inverse(a, b)
  INVERSE_MAP[a] = b
  INVERSE_MAP[b] = a
end

Instance Method Details

#===(x) ⇒ Object



160
161
162
# File 'lib/composite_type.rb', line 160

def === x
   ! (@_t[0] === x)
end

#>=(t) ⇒ Object



164
165
166
167
# File 'lib/composite_type.rb', line 164

def >= t
  t.is_a?(self.class) and
    t._t[0] >= @_t[0]
end

#to_sObject



169
170
171
# File 'lib/composite_type.rb', line 169

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