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. Advertisements

  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. Advertisements

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. Pierre Rouleau
    Replies:
    4
    Views:
    1,046
    Pierre Rouleau
    Mar 7, 2004
  2. plb
    Replies:
    0
    Views:
    582
  3. plb
    Replies:
    0
    Views:
    457
  4. Xiao Jianfeng
    Replies:
    2
    Views:
    989
    Ben Finney
    Dec 16, 2005
  5. Mudcat
    Replies:
    3
    Views:
    1,099
    Steven D'Aprano
    Jan 14, 2006
  6. Peng Yu
    Replies:
    0
    Views:
    489
    Peng Yu
    Oct 31, 2009
  7. Stéphane Klein
    Replies:
    0
    Views:
    454
    Stéphane Klein
    Jul 5, 2011
  8. 3lionz Wexler
    Replies:
    2
    Views:
    1,564
    Suraj Kurapati
    Aug 24, 2010
Loading...