Class: Solargraph::Pin::YardPin::Method

Inherits:
Method show all
Includes:
YardMixin
Defined in:
lib/solargraph/pin/yard_pin/method.rb

Instance Attribute Summary

Attributes included from YardMixin

#code_object, #location, #spec

Attributes inherited from Method

#parameters

Attributes inherited from BaseMethod

#node, #visibility

Attributes inherited from Closure

#scope

Attributes inherited from Base

#code_object, #location, #name, #path, #return_type

Attributes included from Common

#closure, #location

Instance Method Summary collapse

Methods inherited from Method

#completion_item_kind, #nearly?, #overloads, #parameter_names, #probe, #symbol_kind, #try_merge!

Methods inherited from BaseMethod

#documentation, #explicit?, #parameter_names, #parameters, #path, #return_type, #typify

Methods inherited from Closure

#binder, #context, #gates

Methods inherited from Base

#==, #comments, #completion_item_kind, #deprecated?, #directives, #docstring, #filename, #identity, #infer, #inspect, #macros, #maybe_directives?, #nearly?, #probe, #probed?, #proxied?, #proxy, #realize, #symbol_kind, #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, #path, #return_type

Constructor Details

#initialize(code_object, name = nil, scope = nil, visibility = nil, closure = nil, spec = nil) ⇒ Method

Returns a new instance of Method.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/solargraph/pin/yard_pin/method.rb', line 9

def initialize code_object, name = nil, scope = nil, visibility = nil, closure = nil, spec = nil
  closure ||= Solargraph::Pin::Namespace.new(
    name: code_object.namespace.to_s,
    gates: [code_object.namespace.to_s]
  )
  super(
    location: object_location(code_object, spec),
    closure: closure,
    name: name || code_object.name.to_s,
    comments: code_object.docstring ? code_object.docstring.all.to_s : '',
    scope: scope || code_object.scope,
    visibility: visibility || code_object.visibility,
    parameters: get_parameters(code_object),
    explicit: code_object.is_explicit?
  )
end