Class: YARP::StringConcatNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::StringConcatNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of compile-time string concatenation.
"foo" "bar"
^^^^^^^^^^^
Instance Attribute Summary collapse
-
#left ⇒ Object
readonly
attr_reader left: Node.
-
#right ⇒ Object
readonly
attr_reader right: Node.
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) -> StringConcatNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(left, right, location) ⇒ StringConcatNode
constructor
def initialize: (left: Node, right: Node, location: Location) -> void.
- #inspect(inspector = NodeInspector.new) ⇒ Object
Constructor Details
#initialize(left, right, location) ⇒ StringConcatNode
def initialize: (left: Node, right: Node, location: Location) -> void
9553 9554 9555 9556 9557 |
# File 'lib/yarp/node.rb', line 9553 def initialize(left, right, location) @left = left @right = right @location = location end |
Instance Attribute Details
#left ⇒ Object (readonly)
attr_reader left: Node
9547 9548 9549 |
# File 'lib/yarp/node.rb', line 9547 def left @left end |
#right ⇒ Object (readonly)
attr_reader right: Node
9550 9551 9552 |
# File 'lib/yarp/node.rb', line 9550 def right @right end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
9560 9561 9562 |
# File 'lib/yarp/node.rb', line 9560 def accept(visitor) visitor.visit_string_concat_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
9565 9566 9567 |
# File 'lib/yarp/node.rb', line 9565 def child_nodes [left, right] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
9570 9571 9572 |
# File 'lib/yarp/node.rb', line 9570 def comment_targets [left, right] end |
#copy(**params) ⇒ Object
def copy: (**params) -> StringConcatNode
9575 9576 9577 9578 9579 9580 9581 |
# File 'lib/yarp/node.rb', line 9575 def copy(**params) StringConcatNode.new( params.fetch(:left) { left }, params.fetch(:right) { right }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
9587 9588 9589 |
# File 'lib/yarp/node.rb', line 9587 def deconstruct_keys(keys) { left: left, right: right, location: location } end |
#inspect(inspector = NodeInspector.new) ⇒ Object
9591 9592 9593 9594 9595 9596 9597 9598 |
# File 'lib/yarp/node.rb', line 9591 def inspect(inspector = NodeInspector.new) inspector << inspector.header(self) inspector << "├── left:\n" inspector << inspector.child_node(left, "│ ") inspector << "└── right:\n" inspector << inspector.child_node(right, " ") inspector.to_str end |