Sha256: d3bd7a772867eaf2e157effa41125fe1f831585525b46a6d91ab316787c1633c

Contents?: true

Size: 422 Bytes

Versions: 4

Compression:

Stored size: 422 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'rack-plastic')

# This middleware demonstrates how you would add an HTML element to the beginning
# of a web page.
#
module Rack
  class Intro < Plastic
 
    def change_nokogiri_doc(doc)
      h1 = create_node(doc, "h1", "Holy shnikes!")
      h1['style'] = "text-align: center;"
      add_first_child(doc.at_css("body"), h1)
      doc
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rack-plastic-0.1.2 examples/middlewares/intro.rb
rack-plastic-0.1.1 test/middlewares/intro.rb
rack-plastic-0.1.0 test/middlewares/intro.rb
rack-plastic-0.0.3 test/middlewares/intro.rb