mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
20 lines
350 B
Ruby
20 lines
350 B
Ruby
|
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')
|