Eval method in ruby executes string/expression passed as parameter.Example:ree-1.8.7-2010.01 > eval("5+3") => 8 ree-1.8.7-2010.01 > eval("a=5") => 5 ree-1.8.7-2010.01 > eval("b||=a") => 5 Its part of ruby meta-programming and not recommended approach unless there is no any alternative to do.
Category: Ruby
Adhearsion and Telegraph Framework Presentation
Check out this SlideShare Presentation: Adhearsion and Telegraph Framework PresentationView more presentations from Justin Grammens.
Hpricot scraping in ruby
Include gems/library required before getting startedrequire 'hpricot'require 'net/http'require 'rio'# Pass website url to be scrapedurl = "www.funonrails.com"# Define filename to store file locallyfile = "temp.html"# Save page locallyrio(url) < rio (file)# Open page through hpricotdoc = Hpricot(open(file))Apply hpricot library to get right contentsdoc.at("div.pageTitle")doc/"div.pageTitle"doc.search("div.entry")doc//"div.pageTitle"Hpricot API Reference click here
