Organizing My Ruby Code - Do I use modules...

S

sketchitup

I need a little help determining the best way to organize my Ruby
code. I've got a script I'm writing. Lets call it somecoolscript.rb. I
have also created three (3) utility classes that I need to use in
somecoolscript.rb. How do I "import" those classes into
somecoolscript.rb so they are available. Do I need to put the three
(3) utility classes in a module and then require this module in
somecoolscript? Do I need to put my modules on some type of class path
so the Ruby interpreter can find them when it executes
somecoolscript.rb?

Thanks,

The SketchUp Artist
 
T

Trans

Read pickaxe about require/load.

having said that...

require 'yoursupportlib'

where 'yoursupportlib' is located in Ruby's $LOAD_PATH.

you can setup you lib according to setup.rb (look it up) and run i to
copy your files into the right places.

brief, but HTH.
T.
 
R

Robert Klemme

2007/7/27 said:
Read pickaxe about require/load.

having said that...

require 'yoursupportlib'

where 'yoursupportlib' is located in Ruby's $LOAD_PATH.

The current directory works as well.

Kind regards

robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top