Verbose Logging

software development with some really amazing hair

T + S G I F R

Articles tagged with "syntax"

Proc, Block, and Two Smoking Lambdas

· Posted in Programming
Ruby 1.9 has 4 different ways to deal with closures. Cue music Proc Procs are the weird ones of the bunch. Technically, all of these things I'm going to describe are Procs. By that I mean, if you check the class, it's a Proc. A Proc is made by using and passing a block, { |x| x }, or by using the proc keyword, proc { |x| x }. A return from inside exits completely out of the method enclosing the Proc. A Proc doesn't care about t…