Skip to content

Instantly share code, notes, and snippets.

@jaimeiniesta
Created January 10, 2013 20:00
Show Gist options
  • Save jaimeiniesta/4505289 to your computer and use it in GitHub Desktop.
Save jaimeiniesta/4505289 to your computer and use it in GitHub Desktop.
Quick hack to be able to pass an HTML string to MetaInspector, bypassing the scraping of the document
require 'metainspector'
module MetaInspector
class Scraper
attr_writer :document
end
end
page = MetaInspector.new('http://example.com')
page.document = "<html><head><title>hello</title></head></html>"
puts page.title # should be "hello", not "Example Domain"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment