# Organizing My Ruby Code - Do I use modules

**URL:** <https://www.ruby-forum.com/t/organizing-my-ruby-code-do-i-use-modules/110576>\
**Category:** Ruby\
**Created:** [July 27, 2007, 6:46pm UTC](https://www.ruby-forum.com/t/organizing-my-ruby-code-do-i-use-modules/110576 "2007-07-27T18:46:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 27, 2007, 6:46pm UTC](https://www.ruby-forum.com/t/organizing-my-ruby-code-do-i-use-modules/110576/1 "2007-07-27T18:46:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 27, 2007, 7:23pm UTC](https://www.ruby-forum.com/t/organizing-my-ruby-code-do-i-use-modules/110576/2 "2007-07-27T19:23:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 28, 2007, 6:06pm UTC](https://www.ruby-forum.com/t/organizing-my-ruby-code-do-i-use-modules/110576/3 "2007-07-28T18:06:31Z")

</div>

On Jul 27, 10:22 pm, Trans [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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.dancingbison.com](http://www.dancingbison.com)  
Blog: [http://jugad.livejournal.com](http://jugad.livejournal.com)  
PDF creation/conversion toolkit:  
[dancingbison.com](http://www.dancingbison.com/products.html)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 30, 2007, 2:47pm UTC](https://www.ruby-forum.com/t/organizing-my-ruby-code-do-i-use-modules/110576/4 "2007-07-30T14:47:42Z")

</div>

2007/7/27, Trans [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> 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

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 28, 2007, 6:07pm UTC](https://www.ruby-forum.com/t/organizing-my-ruby-code-do-i-use-modules/110576/5 "2007-07-28T18:07:31Z")

</div>

On Jul 27, 10:22 pm, Trans [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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.dancingbison.com](http://www.dancingbison.com)  
Blog: [http://jugad.livejournal.com](http://jugad.livejournal.com)  
PDF creation/conversion toolkit:  
[dancingbison.com](http://www.dancingbison.com/products.html)
