Skip to content

Instantly share code, notes, and snippets.

@klauern
Created January 25, 2009 04:47
Show Gist options
  • Save klauern/51689 to your computer and use it in GitHub Desktop.
Save klauern/51689 to your computer and use it in GitHub Desktop.
# Assume we have the following program and external_file.rb library with defined function external_function.
require "external_file.rb"
a = external_function(1,2,3)
# Where should the loaded library file be located if program executes without errors? Assume that the
# current directory is not the same as the disk root and executed program's directory.
# Note: No command line options were used to invoke Ruby
# Answers:
# In one of the directories RUBYLIB environment variable points to if $SAFE=
# In the current directory
# Explanation:
# Ruby searches for the library files in the current directory and in RUBYLIB directories. This could
# be checked by looking at $: global variable contents.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment