Class: Solargraph::Pin::BaseMethod

Inherits:
Closure show all
Defined in:
lib/solargraph/pin/base_method.rb

Overview

The base class for method and attribute pins.

Direct Known Subclasses

Attribute, MethodAlias

Instance Attribute Summary collapse

Attributes inherited from Closure

#scope

Attributes inherited from Base

#code_object, #kind, #location, #name

Attributes included from Common

#closure, #location

Instance Method Summary collapse

Methods inherited from Closure

#binder, #context

Methods inherited from Base

#==, #comments, #completion_item_kind, #deprecated?, #directives, #docstring, #filename, #infer, #inspect, #macros, #maybe_directives?, #nearly?, #probe, #probed?, #proxied?, #proxy, #realize, #symbol_kind, #to_s, #try_merge!, #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, #kind, #name, #namespace

Constructor Details

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

Returns a new instance of BaseMethod

Parameters:

  • visibility (::Symbol)

    :public, :protected, or :private


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

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

Instance Attribute Details

#visibility::Symbol (readonly)

Returns :public, :private, or :protected

Returns:

  • (::Symbol)

    :public, :private, or :protected


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

def visibility
  @visibility
end

Instance Method Details

#parameter_namesArray<String>

Returns:

  • (Array<String>)

37
38
39
# File 'lib/solargraph/pin/base_method.rb', line 37

def parameter_names
  []
end

#parametersArray<String>

Returns:

  • (Array<String>)

32
33
34
# File 'lib/solargraph/pin/base_method.rb', line 32

def parameters
  []
end

#pathObject


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

def path
  @path ||= namespace.to_s + (scope == :instance ? '#' : '.') + name.to_s
end

#return_typeObject


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

def return_type
  @return_type ||= generate_complex_type
end

#typify(api_map) ⇒ Object


23
24
25
26
27
28
29
# File 'lib/solargraph/pin/base_method.rb', line 23

def typify api_map
  decl = super
  return decl unless decl.undefined?
  type = see_reference(api_map) || typify_from_super(api_map)
  return type.qualify(api_map, namespace) unless type.nil?
  name.end_with?('?') ? ComplexType::BOOLEAN : ComplexType::UNDEFINED
end