From: Ross Bamford Date: 2005-12-02T00:42:31+09:00 Subject: Re: How can I load my own files to ruby? (Win XP) On Thu, 01 Dec 2005 15:25:00 -0000, 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? > (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 :)) -- Ross Bamford - rosco@roscopeco.remove.co.uk "\e[1;31mL"