Class: Solargraph::Source::Chain::Literal

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

Direct Known Subclasses

Hash

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(type) ⇒ Literal

Returns a new instance of Literal.

Parameters:

  • type (String)


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

def initialize type
  @type = type
  @complex_type = ComplexType.try_parse(type)
end

Instance Method Details

#resolve(api_map, name_pin, locals) ⇒ Object



17
18
19
# File 'lib/solargraph/source/chain/literal.rb', line 17

def resolve api_map, name_pin, locals
  [Pin::ProxyType.anonymous(@complex_type)]
end

#wordObject



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

def word
  @word ||= "<#{@type}>"
end