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
#construct_keys, #format, #pretty_print, #to_json
Constructor Details
#initialize(beginning:, parts:, location:) ⇒ RegexpContent
Returns a new instance of RegexpContent.
7416 7417 7418 7419 7420 |
# File 'lib/syntax_tree/node.rb', line 7416 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
7410 7411 7412 |
# File 'lib/syntax_tree/node.rb', line 7410 def beginning @beginning end |
#parts ⇒ Object (readonly)
- Array[ StringDVar | StringEmbExpr | TStringContent ]
-
the parts of the
regular expression
7414 7415 7416 |
# File 'lib/syntax_tree/node.rb', line 7414 def parts @parts end |
Instance Method Details
#accept(visitor) ⇒ Object
7422 7423 7424 |
# File 'lib/syntax_tree/node.rb', line 7422 def accept(visitor) visitor.visit_regexp_content(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
7426 7427 7428 |
# File 'lib/syntax_tree/node.rb', line 7426 def child_nodes parts end |
#deconstruct_keys(_keys) ⇒ Object
7432 7433 7434 |
# File 'lib/syntax_tree/node.rb', line 7432 def deconstruct_keys(_keys) { beginning: beginning, parts: parts, location: location } end |