I am just trying to get some knowledge in Ruby. For this I am playing
with some tutorials.
In the tutorial I have to save some code to a file and load it
afterwards in the irb (with require).
I don't want to mess up the installation, so I am saving all files
under my own special directory E:/User/stk/Programming/Ruby.
Which enviroment variable do I have to use? What shall I do?
There are no comments on this in the installation instructions and in
the faq(s) afaik.
Any help is appreciated. (No, I don't want to make a lot of other
installations to get it done.)
Stephan.
P.S.: I have installed ruby 1.8.2 with the OneClickInstaller on
RubyForge.
(I don't know about Windows, but I expect it's the same in this regard?).
If you start IRB from that directory, you should be able to require your file with a simple:
require 'myfile'
assuming your file is named 'myfile.rb'. You can also give full path/filename to require I think.
Alternatively, a quick and dirty way in IRB is to just do:
$: << 'E:/User/stk/Programming/Ruby' # ?slashes?
when you first run IRB. From then, your directory will be in the library search path.
(Aside: Stick with it - IRB will quickly become one of the most valuable tools you have when learning Ruby :))
···
On Thu, 01 Dec 2005 15:25:00 -0000, Stephan.Kassel@gmx.de <Stephan.Kassel@gmx.de> wrote:
I am just trying to get some knowledge in Ruby. For this I am playing
with some tutorials.
In the tutorial I have to save some code to a file and load it
afterwards in the irb (with require).
I don't want to mess up the installation, so I am saving all files
under my own special directory E:/User/stk/Programming/Ruby.
Which enviroment variable do I have to use? What shall I do?
--
Ross Bamford - rosco@roscopeco.remove.co.uk
"\e[1;31mL"
e:
cd User\stk\Programming\Ruby
irb -r yourfile.rb or irb then requre 'yourfile.rb'
Am I missing something?
···
On Thursday 01 December 2005 09:27, Stephan.Kassel@gmx.de wrote:
In the tutorial I have to save some code to a file and load it
afterwards in the irb (with require).
I don't want to mess up the installation, so I am saving all files
under my own special directory E:/User/stk/Programming/Ruby.
The RUBYLIB environment variable lets you specify additional directories to be searched by 'require'. irb picks this up. Both ruby and irb (at least as of 1.8.2) support a -I option too.
···
Stephan.Kassel@gmx.de wrote:
I am just trying to get some knowledge in Ruby. For this I am playing
with some tutorials.
In the tutorial I have to save some code to a file and load it
afterwards in the irb (with require).
I don't want to mess up the installation, so I am saving all files
under my own special directory E:/User/stk/Programming/Ruby.
Which enviroment variable do I have to use? What shall I do?
Thank you.
This was the answer I really needed. Also many thanks to Ross to
provide me with a quick workaround. My problem is solved. (Maybe until
the next time when I need to know something about useful environment
variables for ruby
Regards,
Stephan.