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.
9982 9983 9984 9985 9986 |
# File 'lib/syntax_tree/node.rb', line 9982 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
9980 9981 9982 |
# File 'lib/syntax_tree/node.rb', line 9980 def comments @comments end |
#parts ⇒ Object (readonly)
- Array[ StringEmbExpr | StringDVar | TStringContent ]
-
the parts of the
xstring
9977 9978 9979 |
# File 'lib/syntax_tree/node.rb', line 9977 def parts @parts end |
Instance Method Details
#accept(visitor) ⇒ Object
9988 9989 9990 |
# File 'lib/syntax_tree/node.rb', line 9988 def accept(visitor) visitor.visit_xstring_literal(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
9992 9993 9994 |
# File 'lib/syntax_tree/node.rb', line 9992 def child_nodes parts end |
#deconstruct_keys(_keys) ⇒ Object
9998 9999 10000 |
# File 'lib/syntax_tree/node.rb', line 9998 def deconstruct_keys(_keys) { parts: parts, location: location, comments: comments } end |
#format(q) ⇒ Object
10002 10003 10004 10005 10006 |
# File 'lib/syntax_tree/node.rb', line 10002 def format(q) q.text("`") q.format_each(parts) q.text("`") end |