Class: Strling::Core::Look
Overview
Represents a lookaround assertion.
Asserts that a pattern does (or does not) match ahead of or behind the current position, without consuming characters.
Instance Attribute Summary collapse
-
#body ⇒ Node
The body of the assertion.
-
#dir ⇒ String
The direction: “Ahead” or “Behind”.
-
#neg ⇒ Boolean
Whether the assertion is negative.
Instance Method Summary collapse
-
#initialize(dir, neg, body) ⇒ Look
constructor
A new instance of Look.
- #to_dict ⇒ Object
Constructor Details
#initialize(dir, neg, body) ⇒ Look
Returns a new instance of Look.
429 430 431 432 433 |
# File 'lib/strling/core/nodes.rb', line 429 def initialize(dir, neg, body) @dir = dir @neg = neg @body = body end |
Instance Attribute Details
#body ⇒ Node
Returns The body of the assertion.
424 425 426 |
# File 'lib/strling/core/nodes.rb', line 424 def body @body end |
#dir ⇒ String
Returns The direction: “Ahead” or “Behind”.
418 419 420 |
# File 'lib/strling/core/nodes.rb', line 418 def dir @dir end |
#neg ⇒ Boolean
Returns Whether the assertion is negative.
421 422 423 |
# File 'lib/strling/core/nodes.rb', line 421 def neg @neg end |
Instance Method Details
#to_dict ⇒ Object
435 436 437 438 439 440 441 442 |
# File 'lib/strling/core/nodes.rb', line 435 def to_dict { 'kind' => 'Look', 'dir' => dir, 'neg' => neg, 'body' => body.to_dict } end |