Uhm... Perhaps this will help you:

module Kernel
  def require_skip(*args)
      catch(:skip) do
          $__SKIPPABLE_REQUIRE__ = true
          require *args
          $__SKIPPABLE_REQUIRE__ = false
      end
  end
end

and then, do something like:
# Requester
require_skip 'File.rb'

# Requested
throw :skip if $__SKIPPABLE_REQUIRE__

If you always want use require_skip instead of require, use this one:
module Kernel
  alias :old_require :require
  def require(*args)
      catch(:skip) do
          $__REQUIRED__ = true
          old_require *args
          $__REQUIRED__ = false
      end
  end
end


If you want do something like this piece of python:
if __FILE__ == '__main__':
   main()

There's the Ruby equivalent:
if self.to_s == 'main'
   main()

-- 
Posted via http://www.ruby-forum.com/.