/examples/nokogiri_html_parser.rb
http://github.com/jnunemaker/httparty · Ruby · 19 lines · 15 code · 4 blank · 0 comment · 0 complexity · 1cbe0a89faf8b794c1ad2372259d9784 MD5 · raw file
- require 'rubygems'
- require 'nokogiri'
- dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
- require File.join(dir, 'httparty')
- require 'pp'
- class HtmlParserIncluded < HTTParty::Parser
- def html
- Nokogiri::HTML(body)
- end
- end
- class Page
- include HTTParty
- parser HtmlParserIncluded
- end
- pp Page.get('http://www.google.com')