Class: YARP::InstanceVariableReadNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::InstanceVariableReadNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents referencing an instance variable.
@foo
^^^^
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) -> InstanceVariableReadNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(name, location) ⇒ InstanceVariableReadNode
constructor
def initialize: (name: Symbol, location: Location) -> void.
- #inspect(inspector = NodeInspector.new) ⇒ Object
Constructor Details
#initialize(name, location) ⇒ InstanceVariableReadNode
def initialize: (name: Symbol, location: Location) -> void
5568 5569 5570 5571 |
# File 'lib/yarp/node.rb', line 5568 def initialize(name, location) @name = name @location = location end |
Instance Attribute Details
#name ⇒ Object (readonly)
attr_reader name: Symbol
5565 5566 5567 |
# File 'lib/yarp/node.rb', line 5565 def name @name end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
5574 5575 5576 |
# File 'lib/yarp/node.rb', line 5574 def accept(visitor) visitor.visit_instance_variable_read_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
5579 5580 5581 |
# File 'lib/yarp/node.rb', line 5579 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
5584 5585 5586 |
# File 'lib/yarp/node.rb', line 5584 def comment_targets [] end |
#copy(**params) ⇒ Object
def copy: (**params) -> InstanceVariableReadNode
5589 5590 5591 5592 5593 5594 |
# File 'lib/yarp/node.rb', line 5589 def copy(**params) InstanceVariableReadNode.new( params.fetch(:name) { name }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
5600 5601 5602 |
# File 'lib/yarp/node.rb', line 5600 def deconstruct_keys(keys) { name: name, location: location } end |
#inspect(inspector = NodeInspector.new) ⇒ Object
5604 5605 5606 5607 5608 |
# File 'lib/yarp/node.rb', line 5604 def inspect(inspector = NodeInspector.new) inspector << inspector.header(self) inspector << "└── name: #{name.inspect}\n" inspector.to_str end |