Self and Scope Toolbox

A good grasp of how the self and scope changes is helpful to become good at Ruby. The table below summarizes how they change.

Self Scope Tool
Changes No Change instance_eval, class_eval
Changes Changes class, def, module
No Change No Change block, Class.new, Module.new, define_method
No Change Changes Recursion, Top level method

We have discussed most of the tools in this book.

Toolbox

As you continue your learning, you now have a way to put the tools into the appropriate slot. This helps you to choose the right tool for a given situation.

results matching ""

    No results matching ""