Class: YARP::ClassVariableTargetNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::ClassVariableTargetNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents writing to a class variable in a context that doesn’t have an explicit value.
@@foo, @@bar = baz
^^^^^ ^^^^^
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
attr_reader name: Symbol.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
-
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location].
-
#copy(**params) ⇒ Object
def copy: (**params) -> ClassVariableTargetNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(name, location) ⇒ ClassVariableTargetNode
constructor
def initialize: (name: Symbol, location: Location) -> void.
- #inspect(inspector = NodeInspector.new) ⇒ Object
Constructor Details
#initialize(name, location) ⇒ ClassVariableTargetNode
def initialize: (name: Symbol, location: Location) -> void
2427 2428 2429 2430 |
# File 'lib/yarp/node.rb', line 2427 def initialize(name, location) @name = name @location = location end |
Instance Attribute Details
#name ⇒ Object (readonly)
attr_reader name: Symbol
2424 2425 2426 |
# File 'lib/yarp/node.rb', line 2424 def name @name end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
2433 2434 2435 |
# File 'lib/yarp/node.rb', line 2433 def accept(visitor) visitor.visit_class_variable_target_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
2438 2439 2440 |
# File 'lib/yarp/node.rb', line 2438 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
2443 2444 2445 |
# File 'lib/yarp/node.rb', line 2443 def comment_targets [] end |
#copy(**params) ⇒ Object
def copy: (**params) -> ClassVariableTargetNode
2448 2449 2450 2451 2452 2453 |
# File 'lib/yarp/node.rb', line 2448 def copy(**params) ClassVariableTargetNode.new( params.fetch(:name) { name }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
2459 2460 2461 |
# File 'lib/yarp/node.rb', line 2459 def deconstruct_keys(keys) { name: name, location: location } end |
#inspect(inspector = NodeInspector.new) ⇒ Object
2463 2464 2465 2466 2467 |
# File 'lib/yarp/node.rb', line 2463 def inspect(inspector = NodeInspector.new) inspector << inspector.header(self) inspector << "└── name: #{name.inspect}\n" inspector.to_str end |