Skip to content

Instantly share code, notes, and snippets.

@reactormonk
Created February 19, 2010 14:09
Show Gist options
  • Save reactormonk/308722 to your computer and use it in GitHub Desktop.
Save reactormonk/308722 to your computer and use it in GitHub Desktop.
require 'nokogiri'
app = proc do |env|
doc = Nokogiri::HTML('<html><head></head><body><div id="hello">Hello World</div></body></html>')
body = doc.css('#hello').content
[body, 200, { 'Content-Type' => 'text/plain', 'Content-Length' => body.size.to_s }]
end
run app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment