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