Class: YARP::StringNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::StringNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents a string literal, a string contained within a ‘%w` list, or plain string content within an interpolated string.
"foo"
^^^^^
%w[foo]
^^^
"foo #{bar} baz"
^^^^ ^^^^
Instance Attribute Summary collapse
-
#closing_loc ⇒ Object
readonly
attr_reader closing_loc: Location?.
-
#content_loc ⇒ Object
readonly
attr_reader content_loc: Location.
-
#opening_loc ⇒ Object
readonly
attr_reader opening_loc: Location?.
-
#unescaped ⇒ Object
readonly
attr_reader unescaped: String.
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?.
-
#content ⇒ Object
def content: () -> String.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(opening_loc, content_loc, closing_loc, unescaped, location) ⇒ StringNode
constructor
def initialize: (opening_loc: Location?, content_loc: Location, closing_loc: Location?, unescaped: String, location: Location) -> void.
-
#opening ⇒ Object
def opening: () -> String?.
Constructor Details
#initialize(opening_loc, content_loc, closing_loc, unescaped, location) ⇒ StringNode
def initialize: (opening_loc: Location?, content_loc: Location, closing_loc: Location?, unescaped: String, location: Location) -> void
5761 5762 5763 5764 5765 5766 5767 |
# File 'lib/yarp/node.rb', line 5761 def initialize(opening_loc, content_loc, closing_loc, unescaped, location) @opening_loc = opening_loc @content_loc = content_loc @closing_loc = closing_loc @unescaped = unescaped @location = location end |
Instance Attribute Details
#closing_loc ⇒ Object (readonly)
attr_reader closing_loc: Location?
5755 5756 5757 |
# File 'lib/yarp/node.rb', line 5755 def closing_loc @closing_loc end |
#content_loc ⇒ Object (readonly)
attr_reader content_loc: Location
5752 5753 5754 |
# File 'lib/yarp/node.rb', line 5752 def content_loc @content_loc end |
#opening_loc ⇒ Object (readonly)
attr_reader opening_loc: Location?
5749 5750 5751 |
# File 'lib/yarp/node.rb', line 5749 def opening_loc @opening_loc end |
#unescaped ⇒ Object (readonly)
attr_reader unescaped: String
5758 5759 5760 |
# File 'lib/yarp/node.rb', line 5758 def unescaped @unescaped end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
5770 5771 5772 |
# File 'lib/yarp/node.rb', line 5770 def accept(visitor) visitor.visit_string_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
5776 5777 5778 |
# File 'lib/yarp/node.rb', line 5776 def child_nodes [] end |
#closing ⇒ Object
def closing: () -> String?
5799 5800 5801 |
# File 'lib/yarp/node.rb', line 5799 def closing closing_loc&.slice end |
#content ⇒ Object
def content: () -> String
5794 5795 5796 |
# File 'lib/yarp/node.rb', line 5794 def content content_loc.slice end |
#deconstruct_keys(keys) ⇒ Object
5784 5785 5786 |
# File 'lib/yarp/node.rb', line 5784 def deconstruct_keys(keys) { opening_loc: opening_loc, content_loc: content_loc, closing_loc: closing_loc, unescaped: unescaped, location: location } end |
#opening ⇒ Object
def opening: () -> String?
5789 5790 5791 |
# File 'lib/yarp/node.rb', line 5789 def opening opening_loc&.slice end |