Wednesday, July 22, 2009

Percent Double Ewe

One of my favorite under-appreciated aspects of the Ruby syntax:


%w{an array of strings} #=> ["an", "array", "of", "strings"]


Two of my favorite uses of this construct:

File::join(%w{who cares what platform}) #=> "who/cares/what/platform"

Kernel::system *%w{sudo cat *} #=> [and the * doesn't glob - WYS is exactly WYG]


Am I the only one who does these things? Or is it just the Rails tide-pool that doesn't?

No comments:

Post a Comment