From: Matt H Date: 2009-11-30T04:50:56+09:00 Subject: Date class method `once` wraps original call in Array. Why? I'm reading the Pickaxe and on page 391, there is a code listing for the class method `once` from the Date module in Ruby: def once(*ids) #:nodoc: for id in ids module_eval <<-"end:" alias_method :__#{id.to_i}__, :#{id.to_s} private :__#{id.to_i}__ def #{id.to_s}(*args, &block) puts "Inside once: \#{args.inspect}" (@__#{id.to_i}__ ||= [__#{id.to_i}__(*args, &block)])[0] end end: end end I was wondering why the original method called is wrapped in an Array. So I started digging the the source history hoping to find an explanation. I found the commit that changed it to use the Array but no explanation for the change. The commit where it was modified is here: I created a simple class and use the code with and without the Array and it seems to work the same for my simple test. Just curious if I'm not seeing something obvious. -- Find me - http://www.smajn.net/social