From: Robert Klemme Date: 2011-12-02T17:25:56+09:00 Subject: Re: Why are there so many similar/identical methods in core classes On Fri, Dec 2, 2011 at 4:15 AM, Kassym Dorsel wrote: > Useless methods? : replace. Why do you need an explicit method for this. > Can't you just use the assignment operator ? No, you can't. irb(main):001:0> a = 5.times.to_a => [0, 1, 2, 3, 4] irb(main):002:0> b = a => [0, 1, 2, 3, 4] irb(main):003:0> a = %w{foo bar} => ["foo", "bar"] irb(main):004:0> b => [0, 1, 2, 3, 4] irb(main):005:0> # BUT --------------------------- irb(main):006:0* a = 5.times.to_a => [0, 1, 2, 3, 4] irb(main):007:0> b = a => [0, 1, 2, 3, 4] irb(main):008:0> a.replace %w{foo bar} => ["foo", "bar"] irb(main):009:0> a => ["foo", "bar"] irb(main):010:0> b => ["foo", "bar"] irb(main):011:0> Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/