[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

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

sketchitup@gmail.com

7/27/2007 4:44:00 PM

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

4 Answers

Trans

7/27/2007 5:23:00 PM

0

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.


vasudevram

7/28/2007 4:03:00 PM

0

On Jul 27, 10:22 pm, Trans <transf...@gmail.com> wrote:
> where 'yoursupportlib' is located in Ruby's $LOAD_PATH.

And you can find the value of $LOAD_PATH by:

ruby -e "puts $:"


Vasudev Ram
Biz site: http://www.dancin...
Blog: http://jugad.livej...
PDF creation/conversion toolkit:
http://www.dancin.../products.html






vasudevram

7/28/2007 4:05:00 PM

0

On Jul 27, 10:22 pm, Trans <transf...@gmail.com> wrote:
> where 'yoursupportlib' is located in Ruby's $LOAD_PATH.

And you can find the value of $LOAD_PATH by:

ruby -e "puts $:"


Vasudev Ram
Biz site: http://www.dancin...
Blog: http://jugad.livej...
PDF creation/conversion toolkit:
http://www.dancin.../products.html






Robert Klemme

7/30/2007 12:47:00 PM

0

2007/7/27, Trans <transfire@gmail.com>:
> 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