From: Lazaridis Ilias Date: 2011-06-05T15:01:10+09:00 Subject: [ruby-core:36743] [Ruby 1.9 - Feature #4824] Provide method Kernel#executed? Issue #4824 has been updated by Lazaridis Ilias. Some notes subjecting the naming: The clarity of the method name should be rated in it's OO context, like this: if self.executed? # or .started? .launched?, which means *not* .included? .required? .loaded? # do main code end similarly, one could write: unless self.executed? # do inclusion code end "self" would be "the module" or "the file" or "the main object" Possibly the most simple word would be "main?", but strictly from a OO view, this would be not correct. Although, from a user view, it looks simple and recognizable: if main? do main stuff end unless main? do inclusion stuff end In any way, the name should be a compact one, e.g. without "_", like is_started? ---------------------------------------- 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