Class: List::Matcher::Node
- Inherits:
-
Object
- Object
- List::Matcher::Node
show all
- Defined in:
- lib/list_matcher.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(engine, symbols) ⇒ Node
Returns a new instance of Node.
454
455
456
457
458
|
# File 'lib/list_matcher.rb', line 454
def initialize(engine, symbols)
@engine = engine
@symbols = symbols
@children = []
end
|
Instance Attribute Details
#engine ⇒ Object
Returns the value of attribute engine.
452
453
454
|
# File 'lib/list_matcher.rb', line 452
def engine
@engine
end
|
#optional ⇒ Object
Returns the value of attribute optional.
452
453
454
|
# File 'lib/list_matcher.rb', line 452
def optional
@optional
end
|
#root ⇒ Object
Returns the value of attribute root.
452
453
454
|
# File 'lib/list_matcher.rb', line 452
def root
@root
end
|
#symbols ⇒ Object
Returns the value of attribute symbols.
452
453
454
|
# File 'lib/list_matcher.rb', line 452
def symbols
@symbols
end
|
Instance Method Details
#atomic? ⇒ Boolean
504
505
506
|
# File 'lib/list_matcher.rb', line 504
def atomic?
false
end
|
#bound ⇒ Object
468
469
470
|
# File 'lib/list_matcher.rb', line 468
def bound
engine.bound
end
|
#children ⇒ Object
476
477
478
|
# File 'lib/list_matcher.rb', line 476
def children
@children ||= []
end
|
#convert ⇒ Object
480
481
482
|
# File 'lib/list_matcher.rb', line 480
def convert
raise NotImplementedError
end
|
#finalize(rx) ⇒ Object
492
493
494
495
496
497
498
|
# File 'lib/list_matcher.rb', line 492
def finalize(rx)
if optional?
rx = wrap rx unless atomic?
rx += qmark
end
rx
end
|
#flatten ⇒ Object
460
461
462
|
# File 'lib/list_matcher.rb', line 460
def flatten
children.each{ |c| c.flatten }
end
|
#optional? ⇒ Boolean
472
473
474
|
# File 'lib/list_matcher.rb', line 472
def optional?
optional
end
|
#optionalize(bool) ⇒ Object
512
513
514
515
516
517
|
# File 'lib/list_matcher.rb', line 512
def optionalize(bool)
if bool
self.optional = bool
end
self
end
|
#pfx ⇒ Object
484
485
486
|
# File 'lib/list_matcher.rb', line 484
def pfx
engine.pfx
end
|
#qmark ⇒ Object
488
489
490
|
# File 'lib/list_matcher.rb', line 488
def qmark
engine.qmark
end
|
#quote(s) ⇒ Object
508
509
510
|
# File 'lib/list_matcher.rb', line 508
def quote(s)
engine.quote s
end
|
#root? ⇒ Boolean
464
465
466
|
# File 'lib/list_matcher.rb', line 464
def root?
root
end
|
#wrap(s) ⇒ Object
500
501
502
|
# File 'lib/list_matcher.rb', line 500
def wrap(s)
engine.wrap s
end
|