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.
412
413
414
415
416
|
# File 'lib/list_matcher.rb', line 412
def initialize(engine, symbols)
@engine = engine
@symbols = symbols
@children = []
end
|
Instance Attribute Details
#engine ⇒ Object
Returns the value of attribute engine.
410
411
412
|
# File 'lib/list_matcher.rb', line 410
def engine
@engine
end
|
#optional ⇒ Object
Returns the value of attribute optional.
410
411
412
|
# File 'lib/list_matcher.rb', line 410
def optional
@optional
end
|
#root ⇒ Object
Returns the value of attribute root.
410
411
412
|
# File 'lib/list_matcher.rb', line 410
def root
@root
end
|
#symbols ⇒ Object
Returns the value of attribute symbols.
410
411
412
|
# File 'lib/list_matcher.rb', line 410
def symbols
@symbols
end
|
Instance Method Details
#atomic? ⇒ Boolean
462
463
464
|
# File 'lib/list_matcher.rb', line 462
def atomic?
false
end
|
#bound ⇒ Object
426
427
428
|
# File 'lib/list_matcher.rb', line 426
def bound
engine.bound
end
|
#children ⇒ Object
434
435
436
|
# File 'lib/list_matcher.rb', line 434
def children
@children ||= []
end
|
#convert ⇒ Object
438
439
440
|
# File 'lib/list_matcher.rb', line 438
def convert
raise NotImplementedError
end
|
#finalize(rx) ⇒ Object
450
451
452
453
454
455
456
|
# File 'lib/list_matcher.rb', line 450
def finalize(rx)
if optional?
rx = wrap rx unless atomic?
rx += qmark
end
rx
end
|
#flatten ⇒ Object
418
419
420
|
# File 'lib/list_matcher.rb', line 418
def flatten
children.each{ |c| c.flatten }
end
|
#optional? ⇒ Boolean
430
431
432
|
# File 'lib/list_matcher.rb', line 430
def optional?
optional
end
|
#pfx ⇒ Object
442
443
444
|
# File 'lib/list_matcher.rb', line 442
def pfx
engine.pfx
end
|
#qmark ⇒ Object
446
447
448
|
# File 'lib/list_matcher.rb', line 446
def qmark
engine.qmark
end
|
#quote(s) ⇒ Object
466
467
468
|
# File 'lib/list_matcher.rb', line 466
def quote(s)
engine.quote s
end
|
#root? ⇒ Boolean
422
423
424
|
# File 'lib/list_matcher.rb', line 422
def root?
root
end
|
#wrap(s) ⇒ Object
458
459
460
|
# File 'lib/list_matcher.rb', line 458
def wrap(s)
engine.wrap s
end
|