Class: Yoda::Model::Values::UnionValue
- Defined in:
- lib/yoda/model/values/union_value.rb
Instance Attribute Summary collapse
- #values ⇒ Array<Values::Base> readonly
Instance Method Summary collapse
-
#initialize(*values) ⇒ UnionValue
constructor
A new instance of UnionValue.
- #instance_value ⇒ IntersectionValue
- #referred_objects ⇒ Object
- #select_constant_paths(name, **kwargs) ⇒ Array<String>
- #select_constant_type(name, **kwargs) ⇒ RBS::Types::t
- #select_method(name, **kwargs) ⇒ Array<FunctionSignatures::Wrapper>
- #singleton_class_value ⇒ IntersectionValue
Constructor Details
#initialize(*values) ⇒ UnionValue
Returns a new instance of UnionValue.
9 10 11 |
# File 'lib/yoda/model/values/union_value.rb', line 9 def initialize(*values) @values = values end |
Instance Attribute Details
#values ⇒ Array<Values::Base> (readonly)
6 7 8 |
# File 'lib/yoda/model/values/union_value.rb', line 6 def values @values end |
Instance Method Details
#instance_value ⇒ IntersectionValue
44 45 46 |
# File 'lib/yoda/model/values/union_value.rb', line 44 def instance_value UnionValue.new(*values.map(&:instance_value)) end |
#referred_objects ⇒ Object
13 14 15 |
# File 'lib/yoda/model/values/union_value.rb', line 13 def referred_objects values.flat_map(&:referred_objects) end |
#select_constant_paths(name, **kwargs) ⇒ Array<String>
33 34 35 36 |
# File 'lib/yoda/model/values/union_value.rb', line 33 def select_constant_paths(name, **kwargs) # Choose methods of shared ancestors values.first&.select_constant_paths(name, **kwargs) || [] end |
#select_constant_type(name, **kwargs) ⇒ RBS::Types::t
26 27 28 29 |
# File 'lib/yoda/model/values/union_value.rb', line 26 def select_constant_type(name, **kwargs) # Choose methods of shared ancestors values.first&.select_constant_type(name, **kwargs) || RBS::Types::Bases::Any.new(location: nil) end |
#select_method(name, **kwargs) ⇒ Array<FunctionSignatures::Wrapper>
19 20 21 22 |
# File 'lib/yoda/model/values/union_value.rb', line 19 def select_method(name, **kwargs) # Choose methods of shared ancestors values.first&.select_method(name, **kwargs) || [] end |
#singleton_class_value ⇒ IntersectionValue
39 40 41 |
# File 'lib/yoda/model/values/union_value.rb', line 39 def singleton_class_value UnionValue.new(*values.map(&:singleton_class_value)) end |