From: Joel VanderWerf Date: 2004-01-24T02:47:51+09:00 Subject: Re: Why is to_a going to be obsolete? Gennady wrote: > I was also surprised to learn that Object#to_a is going to be obsolete. > However, I immediately found a replacement for it that I like even more: > > instead of doing > o.to_a > > I do now > [ *o ] > > And this is not reported as obsolete in Ruby 1.8.1 yet ;-) Don't get too fond of it ;) irb(main):016:0> [~] irb irb(main):001:0> h = {1=>2, :three=>"four"} => {1=>2, :three=>"four"} irb(main):002:0> [*h] => [[1, 2], [:three, "four"]] irb(main):003:0> class << h irb(main):004:1> undef :to_a irb(main):005:1> end => nil irb(main):006:0> h.to_a NoMethodError: undefined method `to_a' for {1=>2, :three=>"four"}:Hash from (irb):6 irb(main):007:0> [*h] NoMethodError: undefined method `to_a' for {1=>2, :three=>"four"}:Hash from (irb):7