class Solargraph::Source::Chain::Literal
Attributes
Public Class Methods
Source
# File lib/solargraph/source/chain/literal.rb, line 17 def initialize type, node if node.is_a?(::Parser::AST::Node) if node.type == :true @value = true elsif node.type == :false @value = false elsif [:int, :sym].include?(node.type) @value = node.children.first end end @type = type @literal_type = ComplexType.try_parse(@value.inspect) @complex_type = ComplexType.try_parse(type) end
@param type [String] @param node [Parser::AST::Node, Object]
Public Instance Methods
Source
# File lib/solargraph/source/chain/literal.rb, line 37 def resolve api_map, name_pin, locals if api_map.super_and_sub?(@complex_type.name, @literal_type.name) [Pin::ProxyType.anonymous(@literal_type, source: :chain)] else # we don't support this value as a literal type [Pin::ProxyType.anonymous(@complex_type, source: :chain)] end end
Source
# File lib/solargraph/source/chain/literal.rb, line 9 def word @word ||= "<#{@type}>" end
Protected Instance Methods
Source
# File lib/solargraph/source/chain/literal.rb, line 33 def equality_fields super + [@value, @type, @literal_type, @complex_type] end
@sg-ignore Fix “Not enough arguments to Module#protected”
Calls superclass method
Solargraph::Source::Chain::Link#equality_fields