Class: Solargraph::Pin::Constant

Inherits:
BaseVariable show all
Defined in:
lib/solargraph/pin/constant.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#namespace, #node, #source

Instance Method Summary collapse

Methods inherited from BaseVariable

#nil_assignment?, #return_type, #signature

Methods included from NodeMethods

#const_from, #infer_literal_node_type, #pack_name, #resolve_node_signature, #unpack_name

Methods inherited from Base

#docstring, #filename, #location, #parameters, #path, #return_type, #signature

Constructor Details

#initialize(source, node, namespace, visibility) ⇒ Constant

Returns a new instance of Constant.



6
7
8
9
# File 'lib/solargraph/pin/constant.rb', line 6

def initialize source, node, namespace, visibility
  super(source, node, namespace)
  @visibility = visibility
end

Instance Attribute Details

#visibility ⇒ Object (readonly)

Returns the value of attribute visibility.



4
5
6
# File 'lib/solargraph/pin/constant.rb', line 4

def visibility
  @visibility
end

Instance Method Details

#kind ⇒ Object



15
16
17
# File 'lib/solargraph/pin/constant.rb', line 15

def kind
  Solargraph::Suggestion::CONSTANT
end

#name ⇒ Object



11
12
13
# File 'lib/solargraph/pin/constant.rb', line 11

def name
  @name ||= node.children[1].to_s
end

#value ⇒ Object



19
20
21
# File 'lib/solargraph/pin/constant.rb', line 19

def value
  source.code_for(node.children[2])
end