Skip to content

Instantly share code, notes, and snippets.

@iande
Created April 10, 2011 21:49
Show Gist options
  • Select an option

  • Save iande/912761 to your computer and use it in GitHub Desktop.

Select an option

Save iande/912761 to your computer and use it in GitHub Desktop.
Example dragnet DSL - First Draft
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
obj
end
end
result_objects #=> [ SomeObject(:title => '...', :url => '...', :description => '...', ...), ... ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment