Class: Rack::Gsub

Inherits:
Plastic
  • Object
show all
Defined in:
lib/rack-gsub.rb

Instance Method Summary collapse

Instance Method Details

#change_nokogiri_doc(doc) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/rack-gsub.rb', line 6

def change_nokogiri_doc(doc)
  doc.at_css("body").traverse do |node|
    if node.text? && node.parent.name != 'textarea' && node.parent.name != 'option'
      options.each do |pattern, replacement|
        update_text(node, node.content.gsub(pattern, replacement))
      end
    end
  end
  doc
end