From: Jan Lelis Date: 2011-06-10T09:08:44+09:00 Subject: [ruby-core:36906] [Ruby 1.9 - Feature #4824] Provide method Kernel#executed? Issue #4824 has been updated by Jan Lelis. I'd still prefer a Kernel method - It's about better readability, isn't it? My favourites: directly_executed? standalone? If it should be some kind of keyword, I can't see any serious issue against the __MAIN__ solution. It's true in the "main" file, false in all others and if __MAIN__ looks OK. ---------------------------------------- Feature #4824: Provide method Kernel#executed? http://redmine.ruby-lang.org/issues/4824 Author: Lazaridis Ilias Status: Open Priority: Normal Assignee: Category: core Target version: The current construct to execute main code looks not very elegant: if __FILE__ == $0 my_main() # call any method or execute any code end With a Kernel#executed? method, this would become more elegant: if executed? #do this #do that my_main() end or main() if executed? This addition would not break any existent behaviour. -- http://redmine.ruby-lang.org