class Solargraph::Pin::Constant
Attributes
Public Class Methods
Source
# File lib/solargraph/pin/constant.rb, line 10 def initialize visibility: :public, **splat super(**splat) @visibility = visibility end
@param visibility [::Symbol] The visibility of the constant (:public, :protected, or :private) @param splat [Hash] Additional options supported by superclasses
Calls superclass method
Solargraph::Pin::BaseVariable::new
Public Instance Methods
Source
# File lib/solargraph/pin/constant.rb, line 19 def completion_item_kind Solargraph::LanguageServer::CompletionItemKinds::CONSTANT end
Source
# File lib/solargraph/pin/constant.rb, line 28 def path @path ||= context.namespace.to_s.empty? ? name : "#{context.namespace}::#{name}" end
Source
# File lib/solargraph/pin/constant.rb, line 15 def return_type @return_type ||= generate_complex_type end
Source
# File lib/solargraph/pin/constant.rb, line 24 def symbol_kind LanguageServer::SymbolKinds::CONSTANT end
@return [Integer]
Private Instance Methods
Source
# File lib/solargraph/pin/constant.rb, line 35 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
@return [ComplexType]