Class: YARP::ConstantReadNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::ConstantReadNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents referencing a constant.
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) -> ConstantReadNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(name, location) ⇒ ConstantReadNode
constructor
def initialize: (name: Symbol, location: Location) -> void.
- #inspect(inspector = NodeInspector.new) ⇒ Object
Constructor Details
#initialize(name, location) ⇒ ConstantReadNode
def initialize: (name: Symbol, location: Location) -> void
3225 3226 3227 3228 |
# File 'lib/yarp/node.rb', line 3225 def initialize(name, location) @name = name @location = location end |
Instance Attribute Details
#name ⇒ Object (readonly)
attr_reader name: Symbol
3222 3223 3224 |
# File 'lib/yarp/node.rb', line 3222 def name @name end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
3231 3232 3233 |
# File 'lib/yarp/node.rb', line 3231 def accept(visitor) visitor.visit_constant_read_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
3236 3237 3238 |
# File 'lib/yarp/node.rb', line 3236 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
3241 3242 3243 |
# File 'lib/yarp/node.rb', line 3241 def comment_targets [] end |
#copy(**params) ⇒ Object
def copy: (**params) -> ConstantReadNode
3246 3247 3248 3249 3250 3251 |
# File 'lib/yarp/node.rb', line 3246 def copy(**params) ConstantReadNode.new( params.fetch(:name) { name }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
3257 3258 3259 |
# File 'lib/yarp/node.rb', line 3257 def deconstruct_keys(keys) { name: name, location: location } end |
#inspect(inspector = NodeInspector.new) ⇒ Object
3261 3262 3263 3264 3265 |
# File 'lib/yarp/node.rb', line 3261 def inspect(inspector = NodeInspector.new) inspector << inspector.header(self) inspector << "└── name: #{name.inspect}\n" inspector.to_str end |