Class: SyntaxTree::StringContent
Overview
StringContent represents the contents of a string-like value.
"string"
Instance Attribute Summary collapse
-
#parts ⇒ Object
readonly
- Array[ StringEmbExpr | StringDVar | TStringContent ]
-
the parts of the string.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(parts:, location:) ⇒ StringContent
constructor
A new instance of StringContent.
Methods inherited from Node
#format, #pretty_print, #to_json
Constructor Details
#initialize(parts:, location:) ⇒ StringContent
Returns a new instance of StringContent.
7440 7441 7442 7443 |
# File 'lib/syntax_tree/node.rb', line 7440 def initialize(parts:, location:) @parts = parts @location = location end |
Instance Attribute Details
#parts ⇒ Object (readonly)
- Array[ StringEmbExpr | StringDVar | TStringContent ]
-
the parts of the
string
7438 7439 7440 |
# File 'lib/syntax_tree/node.rb', line 7438 def parts @parts end |
Instance Method Details
#accept(visitor) ⇒ Object
7445 7446 7447 |
# File 'lib/syntax_tree/node.rb', line 7445 def accept(visitor) visitor.visit_string_content(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
7449 7450 7451 |
# File 'lib/syntax_tree/node.rb', line 7449 def child_nodes parts end |
#deconstruct_keys(keys) ⇒ Object
7455 7456 7457 |
# File 'lib/syntax_tree/node.rb', line 7455 def deconstruct_keys(keys) { parts: parts, location: location } end |