Module: PatternMatch::Pattern::Backtrackable
- Included in:
- PatternMatch::Pattern
- Defined in:
- lib/pattern-match/experimental.rb
Instance Method Summary collapse
Instance Method Details
#choice_points ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/pattern-match/experimental.rb', line 18 def choice_points if root? @choice_points ||= [] else @parent.choice_points end end |
#match(vals) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/pattern-match/experimental.rb', line 10 def match(vals) matched = super if root? and not matched and not choice_points.empty? restore_choice_point end matched end |