Method: Module#|

Defined in:
lib/composite_type.rb

#|(t) ⇒ Object

Constructs a type which can be A OR B.

Array.of(String|Integer)


111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/composite_type.rb', line 111

def | t
  case
  when t <= self
    self
  when self <= t
    t
  else
    a, b = self, t
    a, b = b, a if a.to_s > b.to_s
    DisjunctiveType.new_cached(a, b)
  end
end