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
20 21 22 23 24 25 26 |
# File 'lib/pattern-match/experimental.rb', line 20 def choice_points if root? @choice_points ||= [] else @parent.choice_points end end |
#match(vals) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/pattern-match/experimental.rb', line 12 def match(vals) matched = super if root? and not matched and not choice_points.empty? restore_choice_point end matched end |