Project

General

Profile

Feature #6263

Simple access to toplevel object (main)

Added by Thomas Sawyer about 4 years ago. Updated over 3 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
[ruby-core:44149]

Description

=begin
Maybe I miss something, but why is there no way to get toplevel object easily. Only way seems
to be:

main = eval('self', TOPLEVEL_BINDING)

Would be nice if there were a simple way, maybe special global (({$main})) would be good choice.
=end

History

#1 [ruby-core:44150] Updated by Nobuyoshi Nakada about 4 years ago

  • Description updated (diff)
  • Status changed from Open to Feedback

It's simple, because no one wanted it ever.
Why do you want?

Would be nice if there were a simple way, maybe special global $main would be good choice.

Why don't you set it?

#2 [ruby-core:48274] Updated by Yutaka HARA over 3 years ago

  • Target version changed from 2.0.0 to next minor

Also available in: Atom PDF