Class: SyntaxTree::ConstRef
Overview
ConstRef represents the name of the constant being used in a class or module declaration.
class Container
end
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#constant ⇒ Object
readonly
- Const
-
the constant itself.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
- #format(q) ⇒ Object
-
#initialize(constant:, location:, comments: []) ⇒ ConstRef
constructor
A new instance of ConstRef.
Methods inherited from Node
Constructor Details
#initialize(constant:, location:, comments: []) ⇒ ConstRef
Returns a new instance of ConstRef.
2914 2915 2916 2917 2918 |
# File 'lib/syntax_tree/node.rb', line 2914 def initialize(constant:, location:, comments: []) @constant = constant @location = location @comments = comments end |
Instance Attribute Details
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
2912 2913 2914 |
# File 'lib/syntax_tree/node.rb', line 2912 def comments @comments end |
#constant ⇒ Object (readonly)
- Const
-
the constant itself
2909 2910 2911 |
# File 'lib/syntax_tree/node.rb', line 2909 def constant @constant end |
Instance Method Details
#accept(visitor) ⇒ Object
2920 2921 2922 |
# File 'lib/syntax_tree/node.rb', line 2920 def accept(visitor) visitor.visit_const_ref(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
2924 2925 2926 |
# File 'lib/syntax_tree/node.rb', line 2924 def child_nodes [constant] end |
#deconstruct_keys(keys) ⇒ Object
2930 2931 2932 |
# File 'lib/syntax_tree/node.rb', line 2930 def deconstruct_keys(keys) { constant: constant, location: location, comments: comments } end |
#format(q) ⇒ Object
2934 2935 2936 |
# File 'lib/syntax_tree/node.rb', line 2934 def format(q) q.format(constant) end |