RubyFlow The Ruby and Rails community linklog

PHPs extract and compact functions implemented in ruby

Due to a series of questions on how to dynamically define local variables (which is an anti-pattern, mind you, you almost certainly should use a Hash instead), I went ahead and implemented Kernel#extract and Kernel#compact. Ruby being OO, those pseudo-functions would probably be better implemented as methods (e.g. Binding#extract), but that’s left as an exercise for the reader ;-)

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in