Method: Module#&

Defined in:
lib/composite_type.rb

#&(t) ⇒ Object

Constructs a type which must be A AND B.

Array.of(Positive & Integer)



148
149
150
151
152
153
154
155
156
157
# File 'lib/composite_type.rb', line 148

def & t
  case
  when equal?(t)
    self
  else
    a, b = self, t
    a, b = b, a if a.to_s > b.to_s
    ConjunctiveType.new_cached(a, b)
  end
end