Browse files

Don't pass a proc around cause we don't have to (Thanks, Paul Dix)

  • Loading branch information...
1 parent 2823a12 commit 9a6ee97216ad93cb02f372d906cf5a8a4f43e24d @brynary committed Dec 5, 2008
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/dryopteris/sanitize.rb
View
8 lib/dryopteris/sanitize.rb
@@ -22,16 +22,16 @@ def sanitize(string_or_io, encoding=nil)
doc = Nokogiri::HTML.parse(string_or_io, nil, encoding)
doc.xpath("html/body/*").each do |node|
- traverse_conditionally_top_down(node, self.method(:sanitize_node).to_proc)
+ traverse_conditionally_top_down(node, :sanitize_node)
end
snippet = doc.xpath("html/body").first
snippet.nil? ? "" : snippet.inner_html
end
private
- def traverse_conditionally_top_down(node, proc)
- return if proc.call(node)
- node.children.each {|j| traverse_conditionally_top_down(j, proc)}
+ def traverse_conditionally_top_down(node, method_name)
+ return if send(method_name, node)
+ node.children.each {|j| traverse_conditionally_top_down(j, method_name)}
end

0 comments on commit 9a6ee97

Please sign in to comment.