Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
>> puts File.read('foo.rb') class Foo def hello "Hello, world!" end end => nil >> require 'foo' => true >> f = Foo.new => #<Foo:0x117fbb4> >> f.hello => "Hello, world!" >> Foo.object_id => 9180910 # Now I update foo.rb... >> puts File.read('foo.rb') class Foo def hello "BRAND NEW Hello World!" end end => nil # Reload the file using remove_const and Kernel.load >> Object.send(:remove_const, :Foo) => Foo >> Kernel.load('foo.rb') => true # Existing instance of Foo DOES NOT use the updated method. >> f.hello => "Hello, world!" >> Foo.object_id => 9078500 # New object DOES use the updated method. >> f2 = Foo.new => #<Foo:0x112c6f8> >> f2.hello => "BRAND NEW Hello World!"
This paste will be private.
From the Design Piracy series on my blog: