James Gray
1/8/2006 11:01:00 PM
On Jan 8, 2006, at 4:55 PM, Jonathan Leighton wrote:
> Is there a way to pass each item is a hash as a successive argument
> to a
> function?
>
> ie:
>
> time = {
> :year => 2003
> :month => 03
> :day => 24
> }
> Time.local(time)
Well, Hashes are unordered by definition, but as long as we declare
an order it's doable:
>> time = {
?> :year => 2003,
?> :month => 03,
?> :day => 24
>> }
=> {:month=>3, :year=>2003, :day=>24}
>> Time.local(*time.values_at(:year, :month, :day))
=> Mon Mar 24 00:00:00 CST 2003
Hope that helps.
James Edward Gray II