Class: Solargraph::Pin::Attribute
- Defined in:
- lib/solargraph/pin/attribute.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#access ⇒ Object
readonly
Returns the value of attribute access.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(source, node, namespace, access, docstring) ⇒ Attribute
constructor
A new instance of Attribute.
- #name ⇒ Object
- #path ⇒ Object
- #return_type ⇒ Object
Methods inherited from Base
#docstring, #filename, #kind, #location, #parameters, #signature, #value
Constructor Details
#initialize(source, node, namespace, access, docstring) ⇒ Attribute
Returns a new instance of 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 (readonly)
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 |