Class: Yoda::Model::Values::IntersectionValue

Inherits:
Base
  • Object
show all
Defined in:
lib/yoda/model/values/intersection_value.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*values) ⇒ IntersectionValue

Returns a new instance of IntersectionValue.

Parameters:

  • values (Array<Value>)


9
10
11
# File 'lib/yoda/model/values/intersection_value.rb', line 9

def initialize(*values)
  @values = values
end

Instance Attribute Details

#valuesEnvironment::AccessorInterface (readonly)



6
7
8
# File 'lib/yoda/model/values/intersection_value.rb', line 6

def values
  @values
end

Instance Method Details

#instance_valueUnionValue

Returns:



42
43
44
# File 'lib/yoda/model/values/intersection_value.rb', line 42

def instance_value
  IntersectionValue.new(*values.map(&:instance_value))
end

#referred_objectsObject



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>

Parameters:

  • name (String, Symbol)

Returns:

  • (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

Parameters:

  • name (String, Symbol)

Returns:

  • (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>

Parameters:

  • name (String, Symbol)

Returns:



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_valueUnionValue

Returns:



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