Hi.
In message "[ruby-talk:02645] Re: Ruby Toplevel"
on 00/05/09, Dave Thomas <Dave / thomases.com> writes:
|> |Is there any way to express the Ruby toplevel in Ruby itself (without
|> |cheating and using TOPLEVEL_BINDING)?
|>
|> I don't think there is.
|> Why don't you use TOPLEVEL_BINDING? I'm curious.
|
|I was trying to write a section on the toplevel environment for the
|book. Writing it using TOPLEVEL_BINDING is sort of recursive, and
|doesn't really clarify the explanation. I think I'm just going to have
|to fall back on something like "At the top level, we're executing code
|in the context of some pre-defined object." (unless you can think of a
|better way ;-)
I see what you mean. I was misunderstanding you.
Just use `binding' method at the toplevel. It returns the current binding.
matz.