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
#construct_keys, #pretty_print, #to_json
Constructor Details
#initialize(parts:, location:, comments: []) ⇒ XStringLiteral
Returns a new instance of XStringLiteral.
10027 10028 10029 10030 10031 |
# File 'lib/syntax_tree/node.rb', line 10027 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
10025 10026 10027 |
# File 'lib/syntax_tree/node.rb', line 10025 def comments @comments end |
#parts ⇒ Object (readonly)
- Array[ StringEmbExpr | StringDVar | TStringContent ]
-
the parts of the
xstring
10022 10023 10024 |
# File 'lib/syntax_tree/node.rb', line 10022 def parts @parts end |
Instance Method Details
#accept(visitor) ⇒ Object
10033 10034 10035 |
# File 'lib/syntax_tree/node.rb', line 10033 def accept(visitor) visitor.visit_xstring_literal(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
10037 10038 10039 |
# File 'lib/syntax_tree/node.rb', line 10037 def child_nodes parts end |
#deconstruct_keys(_keys) ⇒ Object
10043 10044 10045 |
# File 'lib/syntax_tree/node.rb', line 10043 def deconstruct_keys(_keys) { parts: parts, location: location, comments: comments } end |
#format(q) ⇒ Object
10047 10048 10049 10050 10051 |
# File 'lib/syntax_tree/node.rb', line 10047 def format(q) q.text("`") q.format_each(parts) q.text("`") end |