Class: Solargraph::Source::Chain::If

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

Constant Summary

Constants included from Logging

Logging::DEFAULT_LOG_LEVEL, Logging::LOG_LEVELS

Instance Attribute Summary

Attributes inherited from Link

#last_context

Instance Method Summary collapse

Methods inherited from Link

#clone_body, #clone_head, #constant?, #desc, #head?, #inspect, #nullable?, #to_s, #undefined?

Methods included from Logging

logger

Methods included from Equality

#==, #eql?, #freeze, #hash

Constructor Details

#initialize(links) ⇒ If

Returns a new instance of If.

Parameters:

  • links (::Array<Link>)


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

def initialize links
  @links = links
end

Instance Method Details

#resolve(api_map, name_pin, locals) ⇒ Object



21
22
23
24
# File 'lib/solargraph/source/chain/if.rb', line 21

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(', ')), source: :chain)]
end

#wordObject



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

def word
  '<if>'
end