Zen of Ruby
A method can take a block as a parameter.
Symbols make good hash keys for a few reasons:
They're immutable, meaning they can't be changed once they're created;
Only one copy of any symbol exists at a given time, so they save memory;
Symbol-as-keys are faster than strings-as-keys because of the above two reasons.
hash lookup is faster with symbol keys than with string keys.
Explicit is better than implicit.PEP 20 -- The Zen of Python | Python.org
You can think of a proc as a "saved" block: just like you can give a bit of code a name and turn it into a method, you can name a block and turn it into a proc.
The Ruby Lambda
Like procs, lambdas are objects. The similarities don't stop there: with the exception of a bit of syntax and a few behavioral quirks, lambdas are identical to procs.
If you're thinking that procs and lambdas look super similar, that's because they are! There are only two main differences.
First, a lambda checks the number of arguments passed to it, while a proc does not. This means that a lambda will throw an error if you pass it the wrong number of arguments, whereas a proc will ignore unexpected arguments and assign nil to any that are missing.
When dealing with classes, you can have variables that are available everywhere (global variables), ones that are only available certain methods (local variables), others that are members of a certain class (class variables), and variables that are only available to particular instances of a class (instance variables).
# instance variables @name # class variables @@name # global variables $name # or define it outside of any method or class