Thanks, and a really interesting perspective.
I find Ruby's rules on scope (and pretty much anything) pretty confusing. I really like the way Ruby does a lot of things, but it doesn't have simple rules like JS.
I find Ruby's rules on scope (and pretty much anything) pretty confusing. I really like the way Ruby does a lot of things, but it doesn't have simple rules like JS.
Also, you might enjoy a silly gem I wrote a while ago called ghost_attributes [1]. It uses closures to mimic attr_accessor. The funny thing about it is that your ghost attributes are completely inaccessible from outside the object, unlike normal instance variables, which are always reachable via things like instance_variable_get. Fun/weird stuff :)
[0] http://www.amazon.com/Metaprogramming-Ruby-Program-Like-Pros...