All pastes #27611 Raw Edit

Something

public ruby v1 · immutable
#27611 ·published 2005-11-04 15:54 UTC
rendered paste body
class Foo  def list_reboots    "foo1\nfoo2\nfoo3\n"  end  def analyse_reboots    list_reboots.split("\n").map {|x| "--#{x}--"}  endendclass Tester  def scenario1    "boot1\nboot2\nboot3\n"  end  def do_test    foo = Foo.new    puts foo.analyse_reboots    prepare(foo, :list_reboots, :scenario1)    puts foo.analyse_reboots    puts Foo.new.analyse_reboots  end  def prepare(obj, obj_method, with)    with_method = method(with)    obj_metaclass = class << obj; self; end    obj_metaclass.__send__(:define_method, obj_method) {with_method.call}  endendTester.new.do_test/tmp $ ruby ./replace.rb --foo1----foo2----foo3----boot1----boot2----boot3----foo1----foo2----foo3--