Class: Solargraph::Pin::BaseVariable
- Includes:
- NodeMethods
- Defined in:
- lib/solargraph/pin/base_variable.rb
Direct Known Subclasses
ClassVariable, Constant, GlobalVariable, InstanceVariable, LocalVariable
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods included from NodeMethods
#const_from, #infer_literal_node_type, #pack_name, #resolve_node_signature, #unpack_name
Methods inherited from Base
#docstring, #filename, #initialize, #location, #parameters, #path, #value
Constructor Details
This class inherits a constructor from Solargraph::Pin::Base
Instance Method Details
#kind ⇒ Object
10 11 12 |
# File 'lib/solargraph/pin/base_variable.rb', line 10 def kind Solargraph::Suggestion::VARIABLE end |
#name ⇒ Object
6 7 8 |
# File 'lib/solargraph/pin/base_variable.rb', line 6 def name node.children[0].to_s end |
#return_type ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/solargraph/pin/base_variable.rb', line 14 def return_type if @return_type.nil? and !docstring.nil? tag = docstring.tag(:type) @return_type = tag.types[0] unless tag.nil? end @return_type ||= literal_from_assignment end |
#signature ⇒ Object
22 23 24 |
# File 'lib/solargraph/pin/base_variable.rb', line 22 def signature @signature ||= resolve_node_signature(node.children[(node.type == :casgn ? 2 : 1)]) end |