Class: Solargraph::Pin::Attribute
- Inherits:
-
Base
- Object
- Base
- Solargraph::Pin::Attribute
show all
- Defined in:
- lib/solargraph/pin/attribute.rb
Instance Attribute Summary collapse
Attributes inherited from Base
#namespace, #node, #source
Instance Method Summary
collapse
Methods inherited from Base
#docstring, #filename, #kind, #location, #parameters, #signature, #value
Constructor Details
#initialize(source, node, namespace, access, docstring) ⇒ Attribute
6
7
8
9
10
|
# File 'lib/solargraph/pin/attribute.rb', line 6
def initialize source, node, namespace, access, docstring
super(source, node, namespace)
@access = access
@docstring = docstring
end
|
Instance Attribute Details
#access ⇒ Object
Returns the value of attribute access.
4
5
6
|
# File 'lib/solargraph/pin/attribute.rb', line 4
def access
@access
end
|
Instance Method Details
#name ⇒ Object
12
13
14
|
# File 'lib/solargraph/pin/attribute.rb', line 12
def name
@name ||= "#{node.children[0]}#{access == :writer ? '=' : ''}"
end
|
#path ⇒ Object
16
17
18
|
# File 'lib/solargraph/pin/attribute.rb', line 16
def path
@path ||= namespace + '#' + name
end
|
#return_type ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/solargraph/pin/attribute.rb', line 20
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
|