Class: List::Matcher::SpecialPattern
Instance Attribute Summary collapse
-
#char ⇒ Object
Returns the value of attribute char.
-
#left ⇒ Object
Returns the value of attribute left.
-
#pat ⇒ Object
Returns the value of attribute pat.
-
#right ⇒ Object
Returns the value of attribute right.
-
#var ⇒ Object
Returns the value of attribute var.
Attributes inherited from Node
#engine, #optional, #root, #symbols
Instance Method Summary collapse
- #atomic? ⇒ Boolean
- #convert ⇒ Object
-
#initialize(engine, char, var, pat, atomic: (var.is_a?(Regexp) && pat.nil?), word_left: false, word_right: false) ⇒ SpecialPattern
constructor
A new instance of SpecialPattern.
- #left? ⇒ Boolean
- #right? ⇒ Boolean
- #to_s ⇒ Object
Methods inherited from Node
#bound, #children, #finalize, #flatten, #optional?, #pfx, #qmark, #quote, #root?, #wrap
Constructor Details
#initialize(engine, char, var, pat, atomic: (var.is_a?(Regexp) && pat.nil?), word_left: false, word_right: false) ⇒ SpecialPattern
Returns a new instance of SpecialPattern.
474 475 476 477 478 479 480 481 482 |
# File 'lib/list_matcher.rb', line 474 def initialize(engine, char, var, pat, atomic: (var.is_a?(Regexp) && pat.nil?), word_left: false, word_right: false) super(engine, nil) @char = char @var = var.is_a?(String) || var.is_a?(Symbol) ? Regexp.new(Regexp.quote(var.to_s)) : var @pat = pat || var.to_s @atomic = !!atomic @left = !!word_left @right = !!word_right end |
Instance Attribute Details
#char ⇒ Object
Returns the value of attribute char.
473 474 475 |
# File 'lib/list_matcher.rb', line 473 def char @char end |
#left ⇒ Object
Returns the value of attribute left.
473 474 475 |
# File 'lib/list_matcher.rb', line 473 def left @left end |
#pat ⇒ Object
Returns the value of attribute pat.
473 474 475 |
# File 'lib/list_matcher.rb', line 473 def pat @pat end |
#right ⇒ Object
Returns the value of attribute right.
473 474 475 |
# File 'lib/list_matcher.rb', line 473 def right @right end |
#var ⇒ Object
Returns the value of attribute var.
473 474 475 |
# File 'lib/list_matcher.rb', line 473 def var @var end |
Instance Method Details
#atomic? ⇒ Boolean
492 493 494 |
# File 'lib/list_matcher.rb', line 492 def atomic? @atomic end |
#convert ⇒ Object
500 501 502 503 |
# File 'lib/list_matcher.rb', line 500 def convert rx = @pat finalize rx end |
#left? ⇒ Boolean
484 485 486 |
# File 'lib/list_matcher.rb', line 484 def left? @left end |
#right? ⇒ Boolean
488 489 490 |
# File 'lib/list_matcher.rb', line 488 def right? @right end |
#to_s ⇒ Object
496 497 498 |
# File 'lib/list_matcher.rb', line 496 def to_s self.char end |