The Array function in Ruby

ruby array tricks chops

12|12|2009

I've seen code before that do the following:

collection = [ var ].flatten # where var might or might not be an array

This idiom is better expressed using

Array(var)
blog comments powered by Disqus