Rootroute ruby language pages|
You can try using
irb. The following is paraphrased from Goto
Kentaro (Gotoken), and originally appeared in ruby-talk:444.
irb/directory to the $RUBYLIB environment variable
irbsomewhere in your path.
chmod +x $RUBYLIB/irb/irb.rb
rehashto tell your login shell about the new command.
readline extension module works with your interpreter,
irb a lot more fun to use.
There is also a simple program,
eval, in the samples/
directory of the Ruby distribution. It lets you enter expressions and
view their values. You can copy
eval into the
site_ruby directory in the Ruby tree, and then invoke it
ruby -r eval -e0
There is a gdb-like debugger for Ruby.
ruby -r debug your_program
Of all the scripting languages, Ruby is probably the easiest to extend. There are no problems with reference counting and variable types, and very few interfaces to learn. In fact, C code used to extend Ruby often ends up looking surprisingly like Ruby code itself.
First, get the Ruby source distribution and read README.EXT. This is a good document, not only if you're writing an extension library, but also if you want to understand Ruby more deeply.
Next, have a look at the source of the interpreter itself, and at the
various supplied extensions in the
You'll also find good examples under
contrib/ on the Ruby ftp sites.
There are two interfaces to Tcl/Tk included in the standard distribution.
One is under
ext/tcltk/ and loaded with
require "tcltk". The syntax is very close to that
Tcl, which is passed to
Unfortunately, the description for this library is written in
The other is under
ext/tk/ and loaded with
"tk". Its syntax closer to the style of the Tk
interface provided by the Perl and Python interfaces.
Your Tk version may be old, try a newer version.
xformsinterfaces in Ruby?
contrib/ in ftp sites.
A Time object can express only the dates between Jan 1, 1970 and Jan 19, 2038.
Two standard extension library modules are provided:
require "date", which is simple and uses the
English calendar, and
require "date2", which is
more general purpose.