From: Mike Austin Date: 2010-08-08T05:00:08+09:00 Subject: Re: Adding sugar to Ruby On 08/06/2010 12:41 PM, Jan Lelis wrote: > Hi, I've collected some nice little additions to Ruby and put them in a > gem called zucker. > > Some of the features: > > * control structure like iteration: > > iterate [1,2], [3,4,5] do |e,f| > puts "#{e},#{f}" > end > # outputs > # 1,3 > # 2,4 > # ,5 > > * Regexp.union shortcut > > /Ruby\d/ | /test/i | "cheat" > # creates a Regexp similar to: > # /(Ruby\d|[tT][eE][sS][tT]|cheat)/ > > * Blocks, where nil can be egocentric > > egonil do > nil.some_methods.that[:do].not.exist > end # => nil > > * Array#to_proc > > [1,2,3].map &[:*, 5] # => [5, 10, 15] > > * More at http://rubyzucker.info / http://github.com/janlelis/zucker > > What's your opinion about these methods? I like the way you think :) These feel like a natural progression, although I admit the array to proc is a bit hacky (but useful). Mike