Class: SyntaxTree::XString
Overview
XString represents the contents of an XStringLiteral.
`ls`
Instance Attribute Summary collapse
-
#parts ⇒ Object
readonly
- Array[ StringEmbExpr | StringDVar | TStringContent ]
-
the parts of the xstring.
Attributes inherited from Node
Instance Method Summary collapse
- #===(other) ⇒ Object
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #copy(parts: nil, location: nil) ⇒ Object
- #deconstruct_keys(_keys) ⇒ Object
-
#initialize(parts:, location:) ⇒ XString
constructor
A new instance of XString.
Methods inherited from Node
#construct_keys, #format, #pretty_print, #to_json
Constructor Details
#initialize(parts:, location:) ⇒ XString
Returns a new instance of XString.
12045 12046 12047 12048 |
# File 'lib/syntax_tree/node.rb', line 12045 def initialize(parts:, location:) @parts = parts @location = location end |
Instance Attribute Details
#parts ⇒ Object (readonly)
- Array[ StringEmbExpr | StringDVar | TStringContent ]
-
the parts of the
xstring
12043 12044 12045 |
# File 'lib/syntax_tree/node.rb', line 12043 def parts @parts end |
Instance Method Details
#===(other) ⇒ Object
12071 12072 12073 |
# File 'lib/syntax_tree/node.rb', line 12071 def ===(other) other.is_a?(XString) && ArrayMatch.call(parts, other.parts) end |
#accept(visitor) ⇒ Object
12050 12051 12052 |
# File 'lib/syntax_tree/node.rb', line 12050 def accept(visitor) visitor.visit_xstring(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
12054 12055 12056 |
# File 'lib/syntax_tree/node.rb', line 12054 def child_nodes parts end |
#copy(parts: nil, location: nil) ⇒ Object
12058 12059 12060 12061 12062 12063 |
# File 'lib/syntax_tree/node.rb', line 12058 def copy(parts: nil, location: nil) XString.new( parts: parts || self.parts, location: location || self.location ) end |
#deconstruct_keys(_keys) ⇒ Object
12067 12068 12069 |
# File 'lib/syntax_tree/node.rb', line 12067 def deconstruct_keys(_keys) { parts: parts, location: location } end |