class Solargraph::Pin::Constant

Attributes

visibility[R]

Public Class Methods

new(visibility: :public, **splat) click to toggle source
Calls superclass method Solargraph::Pin::BaseVariable::new
# File lib/solargraph/pin/constant.rb, line 8
def initialize visibility: :public, **splat
  super(**splat)
  @visibility = visibility
end

Public Instance Methods

completion_item_kind() click to toggle source
# File lib/solargraph/pin/constant.rb, line 17
def completion_item_kind
  Solargraph::LanguageServer::CompletionItemKinds::CONSTANT
end
path() click to toggle source
# File lib/solargraph/pin/constant.rb, line 26
def path
  @path ||= context.namespace.to_s.empty? ? name : "#{context.namespace}::#{name}"
end
return_type() click to toggle source
# File lib/solargraph/pin/constant.rb, line 13
def return_type
  @return_type ||= generate_complex_type
end
symbol_kind() click to toggle source

@return [Integer]

# File lib/solargraph/pin/constant.rb, line 22
def symbol_kind
  LanguageServer::SymbolKinds::CONSTANT
end

Private Instance Methods

generate_complex_type() click to toggle source

@return [ComplexType]

# File lib/solargraph/pin/constant.rb, line 33
def generate_complex_type
  tags = docstring.tags(:return).map(&:types).flatten.reject(&:nil?)
  if tags.empty?
    tags = docstring.tags(:type).map(&:types).flatten.reject(&:nil?)
  end
  return ComplexType::UNDEFINED if tags.empty?
  ComplexType.try_parse *tags
end