In which order are files looked for when loaded/requierd - and what'sthe order of suffixes?

Discussion in 'Ruby' started by Stephan Kämper, Jan 17, 2004.

  1. Hi all,

    when I

    require 'whatever'

    or

    load 'something_else'

    how can I tell in which order the directories are searched for the file
    in question? And what's the order fo suffixes to the file ( .rb, .so, ...)?

    Is the directory order the order of the entries in $: (or $LOAD_PATH
    which I tend to prefer after requiring 'English')?
    Hmm, probably not, since '.' is the last entry in the current $: (which
    I didn't change)

    Thanks for any input and happy rubying!

    Stephan


    --
    "It's POLYMORPHIC!!!"
    A fromer colleague
    Stephan Kämper, Jan 17, 2004
    #1
    1. Advertising

  2. Stephan Kämper

    Guest

    Re: In which order are files looked for when loaded/requierd - and what's the order of suffixes?

    Hi,

    At Sun, 18 Jan 2004 02:45:03 +0900,
    Stephan Kämper wrote:
    > how can I tell in which order the directories are searched for the file
    > in question? And what's the order fo suffixes to the file ( .rb, .so, ...)?


    Directories in $:, and suffixes are in order "rb",
    Config::CONFIG["DLEXT"] and Config::CONFIG["DLEXT2"] if
    available. Config::CONFIG is defined in rbconfig.rb.

    > Is the directory order the order of the entries in $: (or $LOAD_PATH
    > which I tend to prefer after requiring 'English')?


    Yes.

    > Hmm, probably not, since '.' is the last entry in the current $: (which
    > I didn't change)


    What do you mean?

    --
    Nobu Nakada
    , Jan 18, 2004
    #2
    1. Advertising

  3. Re: In which order are files looked for when loaded/requierd - andwhat's the order of suffixes?

    wrote:
    >
    >>Hmm, probably not, since '.' is the last entry in the current $: (which
    >>I didn't change)

    >
    > What do you mean?


    Sorry for being unclear. I meant to say that

    a) "." is the last element of $:.

    [715] stk@tao ~: irb
    irb(main):001:0> $:
    => ["/usr/local/lib/ruby/site_ruby/1.8",
    "/usr/local/lib/ruby/site_ruby/1.8/i686-linux",
    "/usr/local/lib/ruby/site_ruby", "/usr/local/lib/ruby/1.8",
    "/usr/local/lib/ruby/1.8/i686-linux",
    "."]
    irb(main):002:0> $:.last == "."
    => true

    b) I thought "." would be searched first. Apparently I was wrong...

    Thanks for your help!

    Happy rubying everybody

    Stephan


    --
    "It's POLYMORPHIC!!!"
    A fromer colleague
    Stephan Kämper, Jan 18, 2004
    #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. Shapper
    Replies:
    1
    Views:
    365
    =?Utf-8?B?RWx0b24gVw==?=
    Apr 23, 2005
  2. Zachary Buckholz
    Replies:
    11
    Views:
    143
    G Klinedinst
    Jan 17, 2004
  3. Mark Heieis
    Replies:
    0
    Views:
    84
    Mark Heieis
    Jan 11, 2014
  4. Stefan Behnel
    Replies:
    0
    Views:
    66
    Stefan Behnel
    Jan 11, 2014
  5. Mark Heieis
    Replies:
    0
    Views:
    58
    Mark Heieis
    Jan 18, 2014
Loading...

Share This Page