Map and to_proc to easier capitalize array of strings
["auckland", "christchurch", "wellington", "hamilton", "tauranga", "dunedin", "palmerston north", "hastings", "nelson", "napier", "rotorua", "new plymouth", "whangarei", "invercargill", "wanganui", "gisborne"].map(&:capitalize)
Posted on April 1, 2009 at 10:17 am by Jordan Carter · Permalink
· 2 Comments
In: Uncategorized · Tagged with: blocks, Proc, Rails, Ruby, to_proc
In: Uncategorized · Tagged with: blocks, Proc, Rails, Ruby, to_proc
Ruby trick – Save a sort for later, Reuse a sort block
Sort multiple arrays with a single block/proc
Posted on March 29, 2009 at 12:09 pm by Jordan Carter · Permalink
· Leave a comment
In: Uncategorized · Tagged with: Block, Proc, Reuse, Ruby, Sort
In: Uncategorized · Tagged with: Block, Proc, Reuse, Ruby, Sort