From: Joel VanderWerf Date: 2006-04-19T06:06:20+09:00 Subject: Re: String#clear James Edward Gray II wrote: > Today I was using an Array and a String to track some info in my unit > tests. I needed to clear them in the #teardown routine. My first > thought was: > > [@some_arr, @some_str].each { |var| var.clear } > > I was surprised when that exploded and I had to change it to: > > @some_arr.clear > @some_str.replace("") > > Is there any good reason String can't have a #clear method? > > James Edward Gray II $ irb19 irb(main):001:0> "foo".clear => "" irb(main):002:0> RUBY_VERSION => "1.9.0" -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407