To echo what Hugh and Jenna said, if I'm understnading you correctly, you're making this more complicated than it needs to be.

You're talking about the visibility of methods and instance variables, and there's no scoping issues to worry about there -- instance variables and methods are *all* available *everywhere* in an object's methods, no matter where and when they're defined. That's true in Ruby in general -- no special Shoes magic.

The extreme simplicity of that is one reason Shoes folk tend to go straight to instance variables and to define all their methods inside the Shoes.app block, at least for very simple apps; as long as you do everything within your Shoes.app do...end block, you can treat instance variables pretty much as if they were globals and methods as if they were top-level functions.

But as Jenna said, it is indeed possible to play with blocks using pure Ruby, and it's one of the most fun things about Ruby. It's just that that is not necessary to explain the visibility issues you were talking about.

Reply via email to