Newbie question: Where to put library .rb files?

Discussion in 'Ruby' started by Kenneth McDonald, Nov 4, 2008.

  1. At our site, newly started using Ruby, we're now starting to get code
    we'd like to make generally available via 'require'. What is the
    standard location/method for doing this? Can it be done in such a
    manner that rdoc and ri documentation is made available to the site,
    preferably integrated with the rest of the ruby docs on this site?

    Thanks,
    Ken McDonald
    Kenneth McDonald, Nov 4, 2008
    #1
    1. Advertising

  2. On Nov 4, 12:22 pm, Kenneth McDonald
    <> wrote:
    > At our site, newly started using Ruby, we're now starting to get code  
    > we'd like to make generally available via 'require'. What is the  
    > standard location/method for doing this? Can it be done in such a  
    > manner that rdoc and ri documentation is made available to the site,  
    > preferably integrated with the rest of the ruby docs on this site?
    >
    > Thanks,
    > Ken McDonald


    The place you want is ruby\lib\ruby\site_ruby.

    For example, I have my home-grown utility Search.rb stored there,
    which defines a Search class. Then a Ruby program stored anywhere can
    simply include:

    require 'search' # case-insensitive on WinXP, e.g.
    s = Seach.new # etc.

    HTH,
    Richard
    RichardOnRails, Nov 5, 2008
    #2
    1. Advertising

  3. Kenneth McDonald

    Jeff Moore Guest

    Kenneth McDonald wrote:
    > At our site, newly started using Ruby, we're now starting to get code
    > we'd like to make generally available via 'require'. What is the
    > standard location/method for doing this? Can it be done in such a
    > manner that rdoc and ri documentation is made available to the site,
    > preferably integrated with the rest of the ruby docs on this site?
    >
    > Thanks,
    > Ken McDonald


    To see what your current config is set to cut-n-paste this into
    irb:


    puts "ruby load directories"
    puts
    $:.each do |e|
    puts e
    end


    Since I work across a variety of platforms, I prefer to set the
    RUBYLIB environment variable on each of my systems to a directory
    of my choosing. This directory is added to load paths in $:

    --
    Posted via http://www.ruby-forum.com/.
    Jeff Moore, Nov 6, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. THY
    Replies:
    9
    Views:
    290
    John Saunders
    Aug 24, 2003
  2. =?Utf-8?B?U3Rhbg==?=
    Replies:
    1
    Views:
    359
    Steven Cheng[MSFT]
    Feb 27, 2004
  3. Justin Mencl
    Replies:
    3
    Views:
    2,040
    Sudsy
    Feb 8, 2004
  4. funnysun
    Replies:
    5
    Views:
    6,698
    funnysun
    Dec 16, 2006
  5. Gabriel Rossetti
    Replies:
    3
    Views:
    541
    Jerry Hill
    Apr 25, 2008
Loading...

Share This Page