# File scripts/ad.rb, line 64 def apply_rule(rule) # we keep track of the changes we make to the text pieces new_tps = @text_portions.clone @text_portions.each do |i,tp| if tp.txt =~ rule.match and not tp.is_match new_tps.merge!(tp.split_on_rule(rule,self)) end end # This will replace the existing tps with those after the match @text_portions = new_tps end