Class: Yoda::Model::Values::IntersectionValue
- Defined in:
- lib/yoda/model/values/intersection_value.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(*values) ⇒ IntersectionValue
constructor
A new instance of IntersectionValue.
- #instance_value ⇒ UnionValue
- #referred_objects ⇒ Object
- #select_constant_paths(name, **kwargs) ⇒ Array<String>
- #select_constant_type(name, **kwargs) ⇒ RBS::Types::t
- #select_method(name, **kwargs) ⇒ Array<FunctionSignatures::Base>
- #singleton_class_value ⇒ UnionValue
Constructor Details
#initialize(*values) ⇒ IntersectionValue
Returns a new instance of IntersectionValue.
9 10 11 |
# File 'lib/yoda/model/values/intersection_value.rb', line 9 def initialize(*values) @values = values end |
Instance Attribute Details
#values ⇒ Environment::AccessorInterface (readonly)
6 7 8 |
# File 'lib/yoda/model/values/intersection_value.rb', line 6 def values @values end |
Instance Method Details
#instance_value ⇒ UnionValue
42 43 44 |
# File 'lib/yoda/model/values/intersection_value.rb', line 42 def instance_value IntersectionValue.new(*values.map(&:instance_value)) end |
#referred_objects ⇒ Object
13 14 15 |
# File 'lib/yoda/model/values/intersection_value.rb', line 13 def referred_objects values.flat_map(&:referred_objects) end |
#select_constant_paths(name, **kwargs) ⇒ Array<String>
32 33 34 |
# File 'lib/yoda/model/values/intersection_value.rb', line 32 def select_constant_paths(name, **kwargs) values.flat_map { |value| select_constant_type(name, **kwargs) }.uniq end |
#select_constant_type(name, **kwargs) ⇒ RBS::Types::t
25 26 27 28 |
# File 'lib/yoda/model/values/intersection_value.rb', line 25 def select_constant_type(name, **kwargs) types = values.flat_map { |value| select_constant_type(name, **kwargs) } RBS::Types::Intersection.new(types: types, location: nil) end |
#select_method(name, **kwargs) ⇒ Array<FunctionSignatures::Base>
19 20 21 |
# File 'lib/yoda/model/values/intersection_value.rb', line 19 def select_method(name, **kwargs) values.flat_map { |value| select_method(name, **kwargs) } end |
#singleton_class_value ⇒ UnionValue
37 38 39 |
# File 'lib/yoda/model/values/intersection_value.rb', line 37 def singleton_class_value IntersectionValue.new(*values.map(&:singleton_class_value)) end |