# File lib/scrubyt/utils/shared_utils.rb, line 28 def self.traverse_for_match(node, regexp) results = [] traverse_for_match_inner = lambda { |node, regexp| ft = prepare_text_for_comparison(node.inner_text) if ft =~ regexp node.instance_eval do @match_data = $~ def match_data @match_data end end results << node results.delete node.parent if node.is_a? Hpricot::Elem end node.children.each { |child| traverse_for_match_inner.call(child, regexp) if (child.is_a? Hpricot::Elem) } } traverse_for_match_inner.call(node,regexp) results end