Class: Class
Instance Method Summary collapse
-
#|(other) ⇒ UnionType
Returns a UnionType combining
selfandother.
Instance Method Details
#|(other) ⇒ UnionType
Returns a UnionType combining self and other. Enables the String | Integer literal syntax.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/union_type/core_ext.rb', line 12 def |(other) case other when Class UnionType.new(self, other) when UnionType UnionType.new(self, *other) else raise TypeError, "expected Class or UnionType, got #{other.class}" end end |