Project

General

Profile

Feature #4824

Provide method Kernel#executed?

Added by lazaridis.com (Lazaridis Ilias) over 9 years ago. Updated over 2 years ago.

Status:
Assigned
Priority:
Normal
Target version:
-
[ruby-core:36730]

Description

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.

Also available in: Atom PDF