Module: Types::Generic

Included in:
Array, Block, Boolean, Class, Class, Decimal, Float, Hash, Integer, Lambda, Method, Nil, Numeric, String, Symbol, Tuple
Defined in:
lib/types/generic.rb

Overview

An extension module which allows constructing ‘Any` types using the `|` operator.

Instance Method Summary collapse

Instance Method Details

#composite?Boolean

Whether a type contains nested types or not.

Returns:



35
36
37
# File 'lib/types/generic.rb', line 35

def composite?
	false
end

#to_sObject



39
40
41
# File 'lib/types/generic.rb', line 39

def to_s
	self.name.rpartition('::').last
end

#|(other) ⇒ Object

Create an instance of ‘Any` with the arguments as types.



30
31
32
# File 'lib/types/generic.rb', line 30

def | other
	Any.new([self, other])
end