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

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

Instance Method Summary collapse

Constructor Details

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


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

def initialize code_object, location, name = nil, scope = nil, visibility = nil, closure = nil
  @code_object = code_object
  comments = (code_object.docstring ? code_object.docstring.all : nil)
  closure ||= Solargraph::Pin::Namespace.new(
    name: code_object.namespace.to_s
  )
  super(
    location: location,
    closure: closure,
    name: name || code_object.name.to_s,
    comments: comments,
    scope: scope || code_object.scope,
    visibility: visibility || code_object.visibility,
    args: get_parameters(code_object)
  )
end