Author: Ezekiel Templin
Date: February 06, 2011
Summary: Comparing Nokogiri's parsers
Operating System: Mac OS X 10.6.6 (10J567)
CPU: Intel Core i7 2.66 GHz
class Result | |
# Possible attributes: | |
# seller_name: String, nil | |
# title : String, nil | |
# description: String | |
# price : Decimal | |
def human_readable_on_base | |
str = if self.title | |
"#{self.title} " |
package_error() | |
{ | |
local _message=$1 | |
if [[ -z "${_message}" ]] | |
then | |
fail "Cannot print a package error as no message was provided." | |
fi | |
local _log=$2 | |
if [[ -n ${_log} ]] && file_exists ${_log} |
result_objects = Google.search("something") do |results| | |
results.map do |link| | |
obj = build_object ... | |
obj.title = link.content | |
obj.url = link.href | |
get(link.href) do |doc| | |
obj.description = doc['div#desc'].content | |
... | |
end |
class Page < Ohm::Model | |
attribute :name | |
attribute :html | |
list :blocks, BlockContent | |
index :name | |
def validate | |
assert_present :name | |
end |