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
9792 9793 9794 9795 9796 |
# File 'lib/syntax_tree/node.rb', line 9792 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
9790 9791 9792 |
# File 'lib/syntax_tree/node.rb', line 9790 def comments @comments end |
#parts ⇒ Object (readonly)
- Array[ StringEmbExpr | StringDVar | TStringContent ]
-
the parts of the
xstring
9787 9788 9789 |
# File 'lib/syntax_tree/node.rb', line 9787 def parts @parts end |
Instance Method Details
#accept(visitor) ⇒ Object
9798 9799 9800 |
# File 'lib/syntax_tree/node.rb', line 9798 def accept(visitor) visitor.visit_xstring_literal(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
9802 9803 9804 |
# File 'lib/syntax_tree/node.rb', line 9802 def child_nodes parts end |
#deconstruct_keys(keys) ⇒ Object
9808 9809 9810 |
# File 'lib/syntax_tree/node.rb', line 9808 def deconstruct_keys(keys) { parts: parts, location: location, comments: comments } end |
#format(q) ⇒ Object
9812 9813 9814 9815 9816 |
# File 'lib/syntax_tree/node.rb', line 9812 def format(q) q.text("`") q.format_each(parts) q.text("`") end |