From: Ryan Davis Date: 2011-01-16T17:59:40+09:00 Subject: Re: Library Reference : ri :: Language Reference : ? On Jan 15, 2011, at 11:10 , Kedar Mhaswade wrote: > ri is cool -- library reference at your fingertips (literally ;)) > > Is there a gem that helps me do something similar with language > reference with syntax and an example or two? For instance, > > $ rubyi > -> case > --> multiway decision control structure > --> example: tax = case income > when ... then ... > when ... then ... > else > end > > -> rescue > ... etc. Here is a quick and dirty start: > #!/usr/bin/ruby -w > > require "open-uri" > > url = "http://www.zenspider.com/Languages/Ruby/QuickRef.html" > > f = URI.parse(url).read.split(/\n\n+/) > > ARGV.each do |arg| > puts f.grep(/#{arg}/).join("\n\n").gsub(/<[^>]+?>/, '') > end