Class: Solargraph::Pin::BaseVariable
- Inherits:
-
Base
- Object
- Base
- Solargraph::Pin::BaseVariable
show all
- Includes:
- NodeMethods
- Defined in:
- lib/solargraph/pin/base_variable.rb
Instance Attribute Summary
Attributes inherited from Base
#namespace, #node, #source
Instance Method Summary
collapse
#const_from, #infer_literal_node_type, #pack_name, #resolve_node_signature, #unpack_name
Methods inherited from Base
#docstring, #filename, #initialize, #location, #parameters, #path, #value
Instance Method Details
#name ⇒ Object
6
7
8
|
# File 'lib/solargraph/pin/base_variable.rb', line 6
def name
node.children[0].to_s
end
|
#nil_assignment? ⇒ Boolean
22
23
24
|
# File 'lib/solargraph/pin/base_variable.rb', line 22
def nil_assignment?
node.children[(node.type == :casgn ? 2 : 1)].type == :nil
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
26
27
28
|
# File 'lib/solargraph/pin/base_variable.rb', line 26
def signature
@signature ||= resolve_node_signature(node.children[(node.type == :casgn ? 2 : 1)])
end
|