Class: SyntaxTree::RegexpContent
Overview
RegexpContent represents the body of a regular expression.
/.+ #{pattern} .+/
In the example above, a RegexpContent node represents everything contained within the forward slashes.
Instance Attribute Summary collapse
-
#beginning ⇒ Object
readonly
- String
-
the opening of the regular expression.
-
#parts ⇒ Object
readonly
- Array[ StringDVar | StringEmbExpr | TStringContent ]
-
the parts of the regular expression.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(beginning:, parts:, location:) ⇒ RegexpContent
constructor
A new instance of RegexpContent.
Methods inherited from Node
#format, #pretty_print, #to_json
Constructor Details
#initialize(beginning:, parts:, location:) ⇒ RegexpContent
7163 7164 7165 7166 7167 |
# File 'lib/syntax_tree/node.rb', line 7163 def initialize(beginning:, parts:, location:) @beginning = beginning @parts = parts @location = location end |
Instance Attribute Details
#beginning ⇒ Object (readonly)
- String
-
the opening of the regular expression
7157 7158 7159 |
# File 'lib/syntax_tree/node.rb', line 7157 def beginning @beginning end |
#parts ⇒ Object (readonly)
- Array[ StringDVar | StringEmbExpr | TStringContent ]
-
the parts of the
regular expression
7161 7162 7163 |
# File 'lib/syntax_tree/node.rb', line 7161 def parts @parts end |
Instance Method Details
#accept(visitor) ⇒ Object
7169 7170 7171 |
# File 'lib/syntax_tree/node.rb', line 7169 def accept(visitor) visitor.visit_regexp_content(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
7173 7174 7175 |
# File 'lib/syntax_tree/node.rb', line 7173 def child_nodes parts end |
#deconstruct_keys(keys) ⇒ Object
7179 7180 7181 |
# File 'lib/syntax_tree/node.rb', line 7179 def deconstruct_keys(keys) { beginning: beginning, parts: parts, location: location } end |