Class: Typisch::Type::Any

Inherits:
Union show all
Defined in:
lib/typisch/union.rb

Overview

The Any (or ‘top’) type is just a union of all the top types of the various Type::Constructor subclasses:

Constant Summary collapse

INSTANCE =
new

Instance Attribute Summary

Attributes inherited from Union

#alternative_types

Attributes inherited from Typisch::Type

#name

Instance Method Summary collapse

Methods inherited from Union

#excluding_null, #shallow_check_type, #to_string

Methods inherited from Typisch::Type

#<, #<=, #<=>, #==, #===, #>, #>=, #alternative_types, #annotations, #annotations=, #excluding_null, #inspect, #recursive?, #shallow_check_type, #subexpression_types, subtype?, #target, #to_string

Constructor Details

#initializeAny

Returns a new instance of Any.



57
58
59
# File 'lib/typisch/union.rb', line 57

def initialize
  super(*Constructor::CONSTRUCTOR_TYPE_SUBCLASSES.map {|klass| klass.top_type(self)})
end

Instance Method Details

#canonicalize!Object



63
# File 'lib/typisch/union.rb', line 63

def canonicalize!; end

#check_type(instance) ⇒ Object

skip some unnecessary work checking different alternatives, since we know everything works here:



67
68
69
# File 'lib/typisch/union.rb', line 67

def check_type(instance)
  true
end

#to_sObject



61
# File 'lib/typisch/union.rb', line 61

def to_s(*); @name.inspect; end