Class: Solargraph::Pin::Method
- Inherits:
-
Base
- Object
- Base
- Solargraph::Pin::Method
show all
- Defined in:
- lib/solargraph/pin/method.rb
Instance Attribute Summary collapse
Attributes inherited from Base
#namespace, #node, #source
Instance Method Summary
collapse
Methods inherited from Base
#docstring, #filename, #location, #signature, #value
Constructor Details
#initialize(source, node, namespace, scope, visibility) ⇒ Method
Returns a new instance of Method.
7
8
9
10
11
|
# File 'lib/solargraph/pin/method.rb', line 7
def initialize source, node, namespace, scope, visibility
super(source, node, namespace)
@scope = scope
@visibility = visibility
end
|
Instance Attribute Details
#scope ⇒ Object
Returns the value of attribute scope.
4
5
6
|
# File 'lib/solargraph/pin/method.rb', line 4
def scope
@scope
end
|
#visibility ⇒ Object
Returns the value of attribute visibility.
5
6
7
|
# File 'lib/solargraph/pin/method.rb', line 5
def visibility
@visibility
end
|
Instance Method Details
#name ⇒ Object
13
14
15
|
# File 'lib/solargraph/pin/method.rb', line 13
def name
@name ||= "#{node.children[(node.type == :def ? 0 : 1)]}"
end
|
#parameters ⇒ Object
33
34
35
|
# File 'lib/solargraph/pin/method.rb', line 33
def parameters
@parameters ||= get_method_args
end
|
#path ⇒ Object
17
18
19
|
# File 'lib/solargraph/pin/method.rb', line 17
def path
@path ||= namespace + (scope == :instance ? '#' : '.') + name
end
|
#return_type ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/solargraph/pin/method.rb', line 25
def return_type
if @return_type.nil? and !docstring.nil?
tag = docstring.tag(:return)
@return_type = tag.types[0] unless tag.nil?
end
@return_type
end
|