lib/citrus.rb in citrus-2.3.5 vs lib/citrus.rb in citrus-2.3.6
- old
+ new
@@ -306,10 +306,14 @@
def apply_rule(rule, position, events) # :nodoc:
memo = @cache[rule] ||= {}
if memo[position]
@cache_hits += 1
- events.concat(memo[position])
+ c = memo[position]
+ unless c.empty?
+ events.concat(c)
+ self.pos += events[-1]
+ end
else
index = events.size
rule.exec(self, events)
# Memoize the result so we can use it next time this same rule is