Class: Solargraph::Pin::Constant

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

Constant Summary

Constants included from Logging

Logging::DEFAULT_LOG_LEVEL, Logging::LOG_LEVELS

Instance Attribute Summary collapse

Attributes inherited from BaseVariable

#assignment, #mass_assignment

Attributes inherited from Base

#code_object, #combine_priority, #directives, #docstring, #location, #name, #source, #type_location

Attributes included from Common

#context, #location

Instance Method Summary collapse

Methods inherited from BaseVariable

#==, #combine_with, #nil_assignment?, #probe, #return_types_from_node, #type_desc, #variable?

Methods inherited from Base

#==, #all_location_text, #all_rooted?, #assert_location_provided, #assert_same, #assert_same_array_content, #assert_same_count, #assert_same_macros, #assert_source_provided, #best_location, #choose, #choose_longer, #choose_node, #choose_pin_attr, #choose_pin_attr_with_same_name, #choose_priority, #closure, #combine_directives, #combine_name, #combine_return_type, #combine_with, #comments, #deprecated?, #desc, #dodgy_return_type_source?, #erase_generics, #filename, #identity, #infer, #inner_desc, #inspect, #macros, #maybe_directives?, #nearly?, #needs_consistent_name?, #prefer_rbs_location, #presence_certain?, #probe, #probed?, #proxied?, #proxy, #rbs_location?, #realize, #reset_generated!, #resolve_generics, #resolve_generics_from_context, #to_rbs, #to_s, #transform_types, #type_desc, #typify, #variable?

Methods included from Logging

logger

Methods included from Documenting

#documentation, normalize_indentation, strip_html_comments

Methods included from Conversions

#completion_item, #deprecated?, #detail, #link_documentation, #probed?, #proxied?, #reset_conversions, #resolve_completion_item, #signature_help, #text_documentation

Methods included from Common

#binder, #closure, #comments, #name, #namespace, #source

Constructor Details

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

Returns a new instance of Constant.

Parameters:

  • visibility (::Symbol) (defaults to: :public)

    The visibility of the constant (:public, :protected, or :private)

  • splat (Hash)

    Additional options supported by superclasses



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

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



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

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

#pathObject



28
29
30
# File 'lib/solargraph/pin/constant.rb', line 28

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

#return_typeObject



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

def return_type
  @return_type ||= generate_complex_type
end

#symbol_kindInteger

Returns:

  • (Integer)


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

def symbol_kind
  LanguageServer::SymbolKinds::CONSTANT
end