Class: Solargraph::Pin::Constant

Inherits:
BaseVariable show all
Defined in:
lib/solargraph/pin/constant.rb

Instance Attribute Summary collapse

Attributes inherited from BaseVariable

#assignment

Attributes inherited from Base

#code_object, #location, #name, #source

Attributes included from Common

#closure, #location

Instance Method Summary collapse

Methods inherited from BaseVariable

#==, #nil_assignment?, #probe, #try_merge!, #variable?

Methods inherited from Base

#==, #comments, #deprecated?, #directives, #docstring, #filename, #identity, #infer, #inspect, #macros, #maybe_directives?, #nearly?, #probe, #probed?, #proxied?, #proxy, #realize, #to_s, #try_merge!, #typify, #variable?

Methods included from Documenting

#documentation

Methods included from Conversions

#completion_item, #detail, #link_documentation, #reset_conversions, #resolve_completion_item, #signature_help, #text_documentation

Methods included from Common

#binder, #comments, #context, #name, #namespace

Constructor Details

#initialize(visibility: :public, **splat) ⇒ Constant

Returns a new instance of Constant.



8
9
10
11
# File 'lib/solargraph/pin/constant.rb', line 8

def initialize visibility: :public, **splat
  super(**splat)
  @visibility = visibility
end

Instance Attribute Details

#visibilityObject (readonly)

Returns the value of attribute visibility.



6
7
8
# File 'lib/solargraph/pin/constant.rb', line 6

def visibility
  @visibility
end

Instance Method Details

#completion_item_kindObject



17
18
19
# File 'lib/solargraph/pin/constant.rb', line 17

def completion_item_kind
  Solargraph::LanguageServer::CompletionItemKinds::CONSTANT
end

#pathObject



26
27
28
# File 'lib/solargraph/pin/constant.rb', line 26

def path
  @path ||= context.namespace.to_s.empty? ? name : "#{context.namespace}::#{name}"
end

#return_typeObject



13
14
15
# File 'lib/solargraph/pin/constant.rb', line 13

def return_type
  @return_type ||= generate_complex_type
end

#symbol_kindInteger

Returns:

  • (Integer)


22
23
24
# File 'lib/solargraph/pin/constant.rb', line 22

def symbol_kind
  LanguageServer::SymbolKinds::CONSTANT
end