Class: SyntaxTree::XStringLiteral
Overview
XStringLiteral represents a string that gets executed.
`ls`
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#parts ⇒ Object
readonly
- Array[ StringEmbExpr | StringDVar | TStringContent ]
-
the parts of the xstring.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
- #format(q) ⇒ Object
-
#initialize(parts:, location:, comments: []) ⇒ XStringLiteral
constructor
A new instance of XStringLiteral.
Methods inherited from Node
Constructor Details
#initialize(parts:, location:, comments: []) ⇒ XStringLiteral
Returns a new instance of XStringLiteral.
9228 9229 9230 9231 9232 |
# File 'lib/syntax_tree/node.rb', line 9228 def initialize(parts:, location:, comments: []) @parts = parts @location = location @comments = comments end |
Instance Attribute Details
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
9226 9227 9228 |
# File 'lib/syntax_tree/node.rb', line 9226 def comments @comments end |
#parts ⇒ Object (readonly)
- Array[ StringEmbExpr | StringDVar | TStringContent ]
-
the parts of the
xstring
9223 9224 9225 |
# File 'lib/syntax_tree/node.rb', line 9223 def parts @parts end |
Instance Method Details
#accept(visitor) ⇒ Object
9234 9235 9236 |
# File 'lib/syntax_tree/node.rb', line 9234 def accept(visitor) visitor.visit_xstring_literal(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
9238 9239 9240 |
# File 'lib/syntax_tree/node.rb', line 9238 def child_nodes parts end |
#deconstruct_keys(keys) ⇒ Object
9244 9245 9246 |
# File 'lib/syntax_tree/node.rb', line 9244 def deconstruct_keys(keys) { parts: parts, location: location, comments: comments } end |
#format(q) ⇒ Object
9248 9249 9250 9251 9252 |
# File 'lib/syntax_tree/node.rb', line 9248 def format(q) q.text("`") q.format_each(parts) q.text("`") end |