Class: Solargraph::Pin::Constant

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

Direct Known Subclasses

YardPin::Constant

Instance Attribute Summary collapse

Attributes inherited from BaseVariable

#assignment

Attributes inherited from Base

#code_object, #location, #name, #return_type

Attributes included from Common

#closure, #location

Instance Method Summary collapse

Methods inherited from BaseVariable

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

Methods included from Source::NodeMethods

const_from, drill_signature, get_node_end_position, get_node_start_position, infer_literal_node_type, pack_name, resolve_node_signature, returns_from, unpack_name

Methods inherited from Base

#==, #comments, #deprecated?, #directives, #docstring, #filename, #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

Methods included from Common

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

Constructor Details

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


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

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

Instance Attribute Details

#visibilityObject (readonly)

Returns the value of attribute visibility


4
5
6
# File 'lib/solargraph/pin/constant.rb', line 4

def visibility
  @visibility
end

Instance Method Details

#completion_item_kindObject


15
16
17
# File 'lib/solargraph/pin/constant.rb', line 15

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

#kindObject


11
12
13
# File 'lib/solargraph/pin/constant.rb', line 11

def kind
  Pin::CONSTANT
end

#pathObject


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

def path
  return name if context.namespace.to_s.empty?
  "#{context.namespace}::#{name}"
end

#symbol_kindInteger


20
21
22
# File 'lib/solargraph/pin/constant.rb', line 20

def symbol_kind
  LanguageServer::SymbolKinds::CONSTANT
end