Class: Solargraph::Source::Chain::Or

Inherits:
Link
  • Object
show all
Defined in:
lib/solargraph/source/chain/or.rb

Instance Attribute Summary

Attributes inherited from Link

#last_context

Instance Method Summary collapse

Methods inherited from Link

#==, #clone_body, #clone_head, #constant?, #head?, #nullable?, #undefined?

Constructor Details

#initialize(links) ⇒ Or

Returns a new instance of Or.

Parameters:

  • type (String)


12
13
14
# File 'lib/solargraph/source/chain/or.rb', line 12

def initialize links
  @links = links
end

Instance Method Details

#resolve(api_map, name_pin, locals) ⇒ Object



16
17
18
19
# 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) }
  [Solargraph::Pin::ProxyType.anonymous(Solargraph::ComplexType.try_parse(types.map(&:tag).uniq.join(', ')))]
end

#wordObject



7
8
9
# File 'lib/solargraph/source/chain/or.rb', line 7

def word
  '<or>'
end