From: Nikolai Weibull Date: 2011-12-22T22:56:00+09:00 Subject: [ruby-core:41776] Re: require_relative in eval 2011/12/22 Matthias W��chter : > Now, Rack [http://rack.rubyforge.org/] contains rackup which supports > loading special files (say, config.ru). These files contain normal Ruby > code, except that the lines must be evaluated in the context of a > Rack::Builder.new {���} context ��� this saves typing for the programmer. The > downside is: The file cannot be just load()ed, include()d or require()d > because the desired wrapping in the Builder creation is not possible either > way. Only way out appeared to be eval(). I have a similar problem in one of my libraries, and RubyGems does as well, in regard to loading .gemspec and capturing the Gem::Specification created in it. One solution would be to allow more flexibility in load. Instead of only allowing true or false as the second argument, how about allowing a Module that will be used as the top-level object? I think that this solution could help a lot of DSLs.