Robert said:
I am trying to learn ruby 1.6.8 on a Mac PowerBook G4. I bought the
book, which was very helpful. However, over the years I have found I
learn a language quicker if I can see and run some actual programs. I
grabbed the samples directory from the Windows package that I have at
the office (1.8), but they seem to be more related to TK/TCL than to
ruby. So, is there a source of ruby sample programs out there that I
can grab to play with?
Just guessing, but the windows package doesn't always include all the
usual samples. You can download the source distribution from
ruby-lang.org or a mirror, such as:
http://www.ibiblio.org/pub/languages/ruby/
Then, even if you do not build from this souce, you have access to the
full samples dir. This is what 1.8.1 comes with:
biorhythm.rb biorhythm calculator
cal.rb cal(1) clone
cbreak.rb no echo done by ioctl
clnt.rb socket client
dbmtest.rb test for dbm
dir.rb directory access
dualstack-fetch.rb IPv6 demo
dualstack-httpd.rb IPv6 demo
dstore.rb object database on dbm
eval.rb simple evaluator
export.rb method access example
exyacc.rb extrace BNF from yacc file
fact.rb factorial calculator
fib.awk Fibonacci number (AWK)
fib.pl Fibonacci number (Perl)
fib.py Fibonacci number (Python)
fib.rb Fibonacci number (Ruby)
fib.scm Fibonacci number (Scheme)
freq.rb count word occurrence
from.rb scan mail spool
fullpath.rb convert ls -lR to fullpath format
getopts.test test fot getopt.rb
goodfriday.rb print various christian calendar event.
io.rb io test
irb.rb interactive ruby
less.rb front end for less
list.rb stupid object sample
list2.rb stupid object sample
list3.rb stupid object sample
mine.rb simple mine sweeper
mkproto.rb extract prototype from C
mpart.rb split file int multi part
mrshtest.rb test marshal
observ.rb observer design pattern sample
occur.pl count word occurrence (Perl)
occur.rb count word occurrence (Ruby)
occur2.rb count word occurrence - another style
philos.rb famous dining philosophers
pi.rb calculate PI
rcs.awk random character stereogram (AWK)
rcs.rb random character stereogram (Ruby)
rcs.dat data for random character stereogram
rd2html.rb rd (Ruby Document) to HTML translator
regx.rb regular expression tester
sieve.rb sieve of Eratosthenes
svr.rb socket server
test.rb test suite used by `make test'
time.rb /usr/bin/time clone
trojan.rb simple tool to find file that may be trojan horse.
tsvr.rb socket server using thread
uumerge.rb merge files and uudecode them