From: Todd Benson Date: 2007-07-10T07:55:54+09:00 Subject: Re: Polymorphic Code On 7/9/07, Ari Brown wrote: > But, I take it, I can't modify this single script, right? > > Start: > file.rb > > so that after I download a new patch, all that's left is: > file.rb Yes, you can do that. Also, like Diego mentioned about changing behavior of an object when loading code ... say I have a file test.rb that looks like this: class C def f(x) puts x end end and I go into irb ... irb(main):001:0> load 'test.rb' => true irb(main):002:0> c = C.new => # irb(main):003:0> c.f 1 1 => nil irb(main):004:0> c.g 1 NoMethodError: undefined method 'g' for # from (irb):4 leaving irb sitting there just the way it is, I modify test.rb by adding this method to class C: def g x puts x + 1 end back to irb... irb(main):005:0> c.g 1 NoMethodError: undefined method 'g' for # from (irb):1 irb(main):006:0> load 'test.rb' #reloading the file, but _not_ creating a new c => true irb(main):007:0> c.g 1 2 => nil Todd