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
#construct_keys, #pretty_print, #to_json
Constructor Details
#initialize(constant:, location:, comments: []) ⇒ ConstRef
Returns a new instance of ConstRef.
3295 3296 3297 3298 3299 |
# File 'lib/syntax_tree/node.rb', line 3295 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
3293 3294 3295 |
# File 'lib/syntax_tree/node.rb', line 3293 def comments @comments end |
#constant ⇒ Object (readonly)
- Const
-
the constant itself
3290 3291 3292 |
# File 'lib/syntax_tree/node.rb', line 3290 def constant @constant end |
Instance Method Details
#accept(visitor) ⇒ Object
3301 3302 3303 |
# File 'lib/syntax_tree/node.rb', line 3301 def accept(visitor) visitor.visit_const_ref(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
3305 3306 3307 |
# File 'lib/syntax_tree/node.rb', line 3305 def child_nodes [constant] end |
#deconstruct_keys(_keys) ⇒ Object
3311 3312 3313 |
# File 'lib/syntax_tree/node.rb', line 3311 def deconstruct_keys(_keys) { constant: constant, location: location, comments: comments } end |
#format(q) ⇒ Object
3315 3316 3317 |
# File 'lib/syntax_tree/node.rb', line 3315 def format(q) q.format(constant) end |