Loading file to irb

Say I’ve written a few classes in a .rb file, how do I load the classes to
irb, so I can interactively use them?

If I type ‘irb somethin.rb’, irb reads the file then quits. I want to be
able to load the file, then still type stuff in irb and get responses.

Thanks

Robo

Hello Robo,

Sunday, March 28, 2004, 8:04:29 AM, you wrote:

Say I've written a few classes in a .rb file, how do I load the classes to
irb, so I can interactively use them?

If I type 'irb somethin.rb', irb reads the file then quits. I want to be
able to load the file, then still type stuff in irb and get responses.

Starting irb and then type 'require "somethin.rb"'.

···

--
Best regards,
Lothar mailto:mailinglists@scriptolutions.com

Hi,

At Sun, 28 Mar 2004 15:04:29 +0900,
Robo wrote in [ruby-talk:95978]:

Say I’ve written a few classes in a .rb file, how do I load the classes to
irb, so I can interactively use them?

$ irb --help
Usage: irb.rb [options] [programfile] [arguments]
-f Suppress read of ~/.irbrc
-m Bc mode (load mathn, fraction or matrix are available)
-d Set $DEBUG to true (same as ruby -d') -r load-module Same as ruby -r’

What you need is -r.

···


Nobu Nakada

Say I’ve written a few classes in a .rb file, how do I load the classes to
irb, so I can interactively use them?

require ‘filename’ :slight_smile:

If I type ‘irb somethin.rb’, irb reads the file then quits. I want to be
able to load the file, then still type stuff in irb and get responses.

irb -r filename

···

il Sun, 28 Mar 2004 17:59:32 +1200, “Robo” robo@mars.com ha scritto::

What you need is -r.

Thanks, didn’t really wanna ask such newbie questions, still getting grips
on Ruby and its tools.

Thanks again

Robo