Top-level methods or constants defined outside of any class or module
are implicitly defined in Object.

On Sep 21, 1:30 pm, John Merlino <stoici...@aol.com> wrote:
> For example, you see filescalled
>
> rails/actionpack/lib/action_controller/base.rb
>
> which adds methods and such to the open module ActionController. Whatscopeis 
> ActionController in? Is it justcalledtheglobalscope?
> Obviously, there is namespace resolution lookup. And a good example of
> this is in the Base class of the same file. It references one module
> like this: AbstractController::Layouts  and another module like this:
> Rendering. One uses the :: namespace resolution operator, because
> Layouts module is not within thescopethat class Base is, which is
> module ActionControllerscope, so it has to reference
> AbstractController which must be in theGLOBALscopein order for ruby
> to find it and then it can look there to find Layouts. In contrast,
> Rendering is defined within the ActionControllerscope, and since
> class Base is defined within the ActionControllerscopeas well, it
> doesn't need to use the :: operator. It can simply search within thatscopeand 
> find the module Rendering. So what is thatglobalscopethat
> ActionController and AbstractController are in withinRails?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to