diff options
author | Xavier Noria <fxn@hashref.com> | 2014-12-15 18:22:21 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2014-12-15 18:23:20 +0100 |
commit | 84e38bbaccea1a5f1b74de46f75ae41d95835c80 (patch) | |
tree | f36f6bc0c830f224a66e578227d53d8865963a99 | |
parent | 9d1a405d4a8f71f90542985032ad8a885d0c1473 (diff) | |
download | rails-84e38bbaccea1a5f1b74de46f75ae41d95835c80.tar.gz rails-84e38bbaccea1a5f1b74de46f75ae41d95835c80.tar.bz2 rails-84e38bbaccea1a5f1b74de46f75ae41d95835c80.zip |
autoloading guide: adds nesting rule for Kernel#load [ci skip]
-rw-r--r-- | guides/source/constant_autoloading_and_reloading.md | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/guides/source/constant_autoloading_and_reloading.md b/guides/source/constant_autoloading_and_reloading.md index e2c0d7003d..a426fd75b3 100644 --- a/guides/source/constant_autoloading_and_reloading.md +++ b/guides/source/constant_autoloading_and_reloading.md @@ -141,13 +141,16 @@ executed, and popped after it. * The module object following a `module` keyword gets pushed when its body is executed, and popped after it. -* When a singleton class is opened with `class << object`, said singleton class -gets pushed when the body is executed, and popped after it. +* A singleton class opened with `class << object` gets pushed, and popped later. * When any of the `*_eval` family of methods is called using a string argument, the singleton class of the receiver is pushed to the nesting of the eval'ed code. +* The nesting at the top-level of code interpreted by `Kernel#load` is empty +unless the `load` call receives a true value as second argument, in which case +a newly created anonymous module is pushed by Ruby. + It is interesting to observe that blocks do not modify the stack. In particular the blocks that may be passed to `Class.new` and `Module.new` do not get the class or module being defined pushed to their nesting. That's one of the |