Class: Orbacle::UnionType
- Inherits:
-
Object
- Object
- Orbacle::UnionType
- Defined in:
- lib/orbacle/union_type.rb
Instance Attribute Summary collapse
-
#types_set ⇒ Object
readonly
Returns the value of attribute types_set.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #bottom? ⇒ Boolean
- #each_possible_type ⇒ Object
- #hash ⇒ Object
-
#initialize(types) ⇒ UnionType
constructor
A new instance of UnionType.
- #types ⇒ Object
Constructor Details
#initialize(types) ⇒ UnionType
Returns a new instance of UnionType.
5 6 7 |
# File 'lib/orbacle/union_type.rb', line 5 def initialize(types) @types_set = Set.new(types) end |
Instance Attribute Details
#types_set ⇒ Object (readonly)
Returns the value of attribute types_set.
9 10 11 |
# File 'lib/orbacle/union_type.rb', line 9 def types_set @types_set end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
15 16 17 18 |
# File 'lib/orbacle/union_type.rb', line 15 def ==(other) self.class == other.class && self.types_set == other.types_set end |
#bottom? ⇒ Boolean
36 37 38 |
# File 'lib/orbacle/union_type.rb', line 36 def bottom? false end |
#each_possible_type ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/orbacle/union_type.rb', line 28 def each_possible_type types.each do |type| type.each_possible_type do |t| yield t end end end |
#hash ⇒ Object
20 21 22 23 24 25 |
# File 'lib/orbacle/union_type.rb', line 20 def hash [ self.class, self.types_set, ].hash ^ BIG_VALUE end |
#types ⇒ Object
11 12 13 |
# File 'lib/orbacle/union_type.rb', line 11 def types @types_set end |