Understanding Scope in Ruby

Updated . Posted . Visible to the public.

Scope is all about where something is visible. It’s all about what (variables, constants, methods) is available to you at a given moment. If you understand scope well enough, you should be able to point at any line of your Ruby program and tell which variables are available in that context, and more importantly, which ones are not.

The article gives detailed explanation on the variable scope in ruby with examples that are easy to understand. Every ruby developer should at least know the first part of the article by heart. The second half covers some special cases which are good to know but probably not used that often.

Judith Roth
Last edit
Daniel Straßner
License
Source code in this card is licensed under the MIT License.
Posted by Judith Roth to makandra dev (2017-08-09 06:46)