Library Reference : ri :: Language Reference : ?

K

Kedar Mhaswade

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.

Regards,
Kedar
 
R

Ryan Davis

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top