Here are a few spells and other interesting things that you learned today:
What Scope Gates () are and how Ruby manages scope in general
How to make bindings visible through scopes with Flat Scopes () and Shared Scopes ()
How to execute code in an object’s scope (usually with instance_eval or instance_exec), or even in a Clean Room ()
How to turn a block into an object (a Proc) and back
How to turn a method into an object (a Method or an UnboundMethod) and back
What the differences are between the different types of callable objects: blocks, Procs, lambdas, and plain old methods
How to write your own little DSL
That was a lot of new stuff in a single day. As you sneak out of the office, however, you can’t shake the nagging feeling that you’ll learn some of Ruby’s best-kept secrets tomorrow.
A program to explore those special cases, written by Paul Cantrell, is at . |