document.write("<div class=\"pastie\">\n");
document.write("  <link href=\"http://pastie.org/stylesheets/embed.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n");
document.write("  <link href=\"http://pastie.org/stylesheets/clean.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n");
document.write("  \n");
document.write("\n");
document.write("  \n");
document.write("  \n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("	\n");
document.write("	<div class=\"allcode\">\n");
document.write("		<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n");
document.write("		<tr>\n");
document.write("			<td>\n");
document.write("				\n");
document.write("				<pre class=\"textmate-source-numbers\">1\n");
document.write("2\n");
document.write("3\n");
document.write("4\n");
document.write("5\n");
document.write("6\n");
document.write("7\n");
document.write("8\n");
document.write("9\n");
document.write("10\n");
document.write("11\n");
document.write("12\n");
document.write("13\n");
document.write("14\n");
document.write("15\n");
document.write("16\n");
document.write("17\n");
document.write("18\n");
document.write("19\n");
document.write("20\n");
document.write("21\n");
document.write("22\n");
document.write("23\n");
document.write("24\n");
document.write("25\n");
document.write("26\n");
document.write("27\n");
document.write("28\n");
document.write("29\n");
document.write("30\n");
document.write("31\n");
document.write("32\n");
document.write("33\n");
document.write("34\n");
document.write("35\n");
document.write("36\n");
document.write("37\n");
document.write("38\n");
document.write("39\n");
document.write("40\n");
document.write("41\n");
document.write("42\n");
document.write("43\n");
document.write("44\n");
document.write("45\n");
document.write("46\n");
document.write("47\n");
document.write("48\n");
document.write("49\n");
document.write("50\n");
document.write("51\n");
document.write("52\n");
document.write("53\n");
document.write("54\n");
document.write("55\n");
document.write("56\n");
document.write("57\n");
document.write("58\n");
document.write("59\n");
document.write("60\n");
document.write("61\n");
document.write("62\n");
document.write("63\n");
document.write("64\n");
document.write("<\/pre>\n");
document.write("			<\/td>\n");
document.write("		<td>\n");
document.write("		<pre class=\"textmate-source\"><pre class=\"sunburst\"><span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'>#!/usr/bin/env ruby<\/span>\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># myscript.rb<\/span>\n");
document.write("\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># If you are a Ruby Programmer, this script may be interesting to you.<\/span>\n");
document.write("\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># 1st, You may need to install Hpricot and rest-open-uri:<\/span>\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># gem install hpricot       --source http://gemcutter.org<\/span>\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># gem install rest-open-uri --source http://gemcutter.org<\/span>\n");
document.write("\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># Then you can try 1 of these command lines:<\/span>\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># ruby myscript.rb<\/span>\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># or<\/span>\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># irb -r myscript.rb<\/span>\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># or<\/span>\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># irb<\/span>\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># then <\/span>\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># load \'myscript.rb\'<\/span>\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'>#<\/span>\n");
document.write("\n");
document.write("<span class=\'meta meta_require meta_require_ruby\'><span class=\'keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby\'>require<\/span> <span class=\'string string_quoted string_quoted_single string_quoted_single_ruby\'>\'rubygems\'<\/span><\/span>\n");
document.write("<span class=\'meta meta_require meta_require_ruby\'><span class=\'keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby\'>require<\/span> <span class=\'string string_quoted string_quoted_single string_quoted_single_ruby\'>\'hpricot\'<\/span><\/span>\n");
document.write("<span class=\'meta meta_require meta_require_ruby\'><span class=\'keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby\'>require<\/span> <span class=\'string string_quoted string_quoted_single string_quoted_single_ruby\'>\'rest-open-uri\'<\/span><\/span>\n");
document.write("\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># What does the Hpricot module look like?<\/span>\n");
document.write("<span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@empty_doc<\/span><span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby\'>=<\/span> <span class=\'variable variable_other variable_other_constant variable_other_constant_ruby\'>Hpricot<\/span>\n");
document.write("p <span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;@empty_doc is this: &quot;<\/span>\n");
document.write("p <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@empty_doc<\/span>\n");
document.write("\n");
document.write("\n");
document.write("p <span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;@empty_doc.class is this: &quot;<\/span>\n");
document.write("p <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@empty_doc<\/span>.class\n");
document.write("\n");
document.write("p(<span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;Here are some @empty_doc methods: &quot;<\/span>)\n");
document.write("(<span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@empty_doc<\/span>.methods <span class=\'keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby\'>-<\/span> <span class=\'constant constant_numeric constant_numeric_ruby\'>1<\/span>.methods).each{<span class=\'meta meta_syntax meta_syntax_ruby meta_syntax_ruby_start-block\'> <\/span>|<span class=\'variable variable_other variable_other_block variable_other_block_ruby\'>m<\/span>| p(m)}\n");
document.write("\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># Older versions of Hpricot were helped by a larger buffer_size<\/span>\n");
document.write("<span class=\'support support_class support_class_ruby\'>Hpricot<\/span>.buffer_size <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby\'>=<\/span> <span class=\'constant constant_numeric constant_numeric_ruby\'>262144<\/span>\n");
document.write("\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># Here is a more interesting Hpricot object:<\/span>\n");
document.write("<span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@small_doc<\/span><span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby\'>=<\/span> <span class=\'variable variable_other variable_other_constant variable_other_constant_ruby\'>Hpricot<\/span>(<span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;&lt;div id=\'abc\'&gt;I am a small div-element.&lt;/div&gt;&quot;<\/span>)\n");
document.write("p <span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;@small_doc is this: &quot;<\/span>\n");
document.write("p <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@small_doc<\/span>\n");
document.write("\n");
document.write("p <span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;@small_doc.class is this: &quot;<\/span>\n");
document.write("p <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@small_doc<\/span>.class\n");
document.write("\n");
document.write("p(<span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;Here are some @small_doc methods: &quot;<\/span>)\n");
document.write("(<span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@small_doc<\/span>.methods <span class=\'keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby\'>-<\/span> <span class=\'constant constant_numeric constant_numeric_ruby\'>1<\/span>.methods).each{<span class=\'meta meta_syntax meta_syntax_ruby meta_syntax_ruby_start-block\'> <\/span>|<span class=\'variable variable_other variable_other_block variable_other_block_ruby\'>m<\/span>| p(m)}\n");
document.write("\n");
document.write("p(<span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;Here is the HTML inside of @small_doc: &quot;<\/span>)\n");
document.write("p <span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@small_doc<\/span>.to_html\n");
document.write("\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># Build an Hpricot object from a web page:<\/span>\n");
document.write("hdrs <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby\'>=<\/span> {<span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;User-Agent&quot;<\/span>=&gt;<span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1&quot;<\/span>, <span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;Accept-Charset&quot;<\/span>=&gt;<span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;utf-8&quot;<\/span>, <span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;Accept&quot;<\/span>=&gt;<span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;text/html&quot;<\/span>}\n");
document.write("my_html <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby\'>=<\/span> <span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;&quot;<\/span>\n");
document.write("open(<span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;http://hpricot.com&quot;<\/span>, hdrs).each {|<span class=\'variable variable_other variable_other_block variable_other_block_ruby\'>s<\/span>| my_html <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_augmented keyword_operator_assignment_augmented_ruby\'>&lt;&lt;<\/span> s}\n");
document.write("<span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@web_doc<\/span><span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby\'>=<\/span> <span class=\'variable variable_other variable_other_constant variable_other_constant_ruby\'>Hpricot<\/span>(my_html)\n");
document.write("\n");
document.write("p(<span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;Here are the links inside of this web page:&quot;<\/span>)\n");
document.write("<span class=\'variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby\'>@web_doc<\/span>.search(<span class=\'string string_quoted string_quoted_double string_quoted_double_ruby\'>&quot;a&quot;<\/span>).each{<span class=\'meta meta_syntax meta_syntax_ruby meta_syntax_ruby_start-block\'> <\/span>|<span class=\'variable variable_other variable_other_block variable_other_block_ruby\'>e<\/span>| p(e.to_html) }\n");
document.write("\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># Questions?<\/span>\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># bikle@bikle.com <\/span>\n");
document.write("<span class=\'comment comment_line comment_line_number-sign comment_line_number-sign_ruby\'># Subject: I have a question about Hpricot.<\/span>\n");
document.write("<\/pre><\/pre>\n");
document.write("		<\/td>\n");
document.write("		<\/tr>\n");
document.write("		<\/table>\n");
document.write("	\n");
document.write("	<\/div>\n");
document.write("\n");
document.write("\n");
document.write("  \n");
document.write("  \n");
document.write("  <div class=\"credit\">\n");
document.write("    <div class=\"buttons\">\n");
document.write("      <a href=\"http://pastie.org/pastes/769752.txt\">\n");
document.write("      <img src=\"http://pastie.org/images/view.png\" height=\"20\" width=\"67\" /><\/a>\n");
document.write("    <\/div>\n");
document.write("  \n");
document.write("    <a href=\"http://pastie.org/769752\">Pastie #769752<\/a> linked directly from <a href=\"http://pastie.org/\">Pastie<\/a>.\n");
document.write("  <\/div><\/div>");

