Class: YARP::InterpolatedSymbolNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::InterpolatedSymbolNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents a symbol literal that contains interpolation.
:"foo #{bar} baz"
^^^^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#closing_loc ⇒ Object
readonly
attr_reader closing_loc: Location?.
-
#opening_loc ⇒ Object
readonly
attr_reader opening_loc: Location?.
-
#parts ⇒ Object
readonly
attr_reader parts: Array.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
-
#closing ⇒ Object
def closing: () -> String?.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(opening_loc, parts, closing_loc, location) ⇒ InterpolatedSymbolNode
constructor
def initialize: (opening_loc: Location?, parts: Array, closing_loc: Location?, location: Location) -> void.
-
#opening ⇒ Object
def opening: () -> String?.
- #set_newline_flag(newline_marked) ⇒ Object
Constructor Details
#initialize(opening_loc, parts, closing_loc, location) ⇒ InterpolatedSymbolNode
def initialize: (opening_loc: Location?, parts: Array, closing_loc: Location?, location: Location) -> void
3525 3526 3527 3528 3529 3530 |
# File 'lib/yarp/node.rb', line 3525 def initialize(opening_loc, parts, closing_loc, location) @opening_loc = opening_loc @parts = parts @closing_loc = closing_loc @location = location end |
Instance Attribute Details
#closing_loc ⇒ Object (readonly)
attr_reader closing_loc: Location?
3522 3523 3524 |
# File 'lib/yarp/node.rb', line 3522 def closing_loc @closing_loc end |
#opening_loc ⇒ Object (readonly)
attr_reader opening_loc: Location?
3516 3517 3518 |
# File 'lib/yarp/node.rb', line 3516 def opening_loc @opening_loc end |
#parts ⇒ Object (readonly)
attr_reader parts: Array
3519 3520 3521 |
# File 'lib/yarp/node.rb', line 3519 def parts @parts end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
3533 3534 3535 |
# File 'lib/yarp/node.rb', line 3533 def accept(visitor) visitor.visit_interpolated_symbol_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
3543 3544 3545 |
# File 'lib/yarp/node.rb', line 3543 def child_nodes [*parts] end |
#closing ⇒ Object
def closing: () -> String?
3561 3562 3563 |
# File 'lib/yarp/node.rb', line 3561 def closing closing_loc&.slice end |
#deconstruct_keys(keys) ⇒ Object
3551 3552 3553 |
# File 'lib/yarp/node.rb', line 3551 def deconstruct_keys(keys) { opening_loc: opening_loc, parts: parts, closing_loc: closing_loc, location: location } end |
#opening ⇒ Object
def opening: () -> String?
3556 3557 3558 |
# File 'lib/yarp/node.rb', line 3556 def opening opening_loc&.slice end |
#set_newline_flag(newline_marked) ⇒ Object
3537 3538 3539 3540 |
# File 'lib/yarp/node.rb', line 3537 def set_newline_flag(newline_marked) first = parts.first first.set_newline_flag(newline_marked) if first end |