Class: Solargraph::Source::Chain::Or
- Defined in:
- lib/solargraph/source/chain/or.rb
Constant Summary
Constants included from Logging
Logging::DEFAULT_LOG_LEVEL, Logging::LOG_LEVELS
Instance Attribute Summary collapse
-
#links ⇒ Object
readonly
Returns the value of attribute links.
Attributes inherited from Link
Instance Method Summary collapse
-
#initialize(links) ⇒ Or
constructor
A new instance of Or.
- #resolve(api_map, name_pin, locals) ⇒ Object
Methods inherited from Link
#clone_body, #clone_head, #constant?, #desc, #head?, #inspect, #nullable?, #to_s, #undefined?
Methods included from Logging
Methods included from Equality
#==, #eql?, #equality_fields, #freeze, #hash
Constructor Details
#initialize(links) ⇒ Or
Returns a new instance of Or.
10 11 12 13 14 |
# File 'lib/solargraph/source/chain/or.rb', line 10 def initialize links super('<or>') @links = links end |
Instance Attribute Details
#links ⇒ Object (readonly)
Returns the value of attribute links.
7 8 9 |
# File 'lib/solargraph/source/chain/or.rb', line 7 def links @links end |
Instance Method Details
#resolve(api_map, name_pin, locals) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/solargraph/source/chain/or.rb', line 16 def resolve api_map, name_pin, locals types = @links.map { |link| link.infer(api_map, name_pin, locals) } combined_type = Solargraph::ComplexType.new(types) unless types.all?(&:nullable?) # @sg-ignore flow sensitive typing should be able to handle redefinition combined_type = combined_type.without_nil end [Solargraph::Pin::ProxyType.anonymous(combined_type, source: :chain)] end |