How can I import a ruby module in my script

Discussion in 'Ruby' started by Anil Gollaa, Apr 13, 2009.

  1. Anil Gollaa

    Anil Gollaa Guest

    Hi,
    I want to write a seperated module which contains all common functions
    in file say common.rb And I want to use these functions in my ruby
    script.
    How can I achive these, can anybody help me in this regard.
    --
    Posted via http://www.ruby-forum.com/.
    Anil Gollaa, Apr 13, 2009
    #1
    1. Advertising

  2. Anil Gollaa wrote:
    > Hi,
    > I want to write a seperated module which contains all common functions
    > in file say common.rb And I want to use these functions in my ruby
    > script.
    > How can I achive these, can anybody help me in this regard.


    Just put this line:

    require "common.rb"

    at the beginning of the script. If the files are in the same dir, that's
    enough.

    --
    vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
    Joel VanderWerf, Apr 13, 2009
    #2
    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.

Share This Page