1 def Object.flet(bindings, &block)
4 bindings.each do |the_method, body|
5 old_methods[the_method] = method(the_method)
6 define_method(the_method, body)
12 bindings.each do |the_method, body|
13 define_method(the_method) { |*args| old_methods[the_method].call(*args) }
19 puts "foo" # should output "foo"
21 Object.flet(:puts => lambda { |str| print "#{str.reverse}\n" }) do
22 puts "foo" # should output "oof"
25 puts "foo" # should output "foo"