Hal Fulton wrote:

> 2. I have a mild dislike for the idiom if $0 == __FILE__ (lines) end
> -- because I always indent inside an if, and I don't want to indent,
> and I really just want to say:  break if $0 != __FILE__

This seems to work:

=== x.rb ===
puts "loading x.rb"

alias old_load load
def load(*args)
   catch :break_from_load do
     old_load(*args)
   end
end

throw :break_from_load unless __FILE__ == $0

puts "a"

load(__FILE__)

puts "b"
============