module Decorator
def decorate(obj, &block)
extender = Module.new
extender.module_eval(&block)
obj.extend extender
obj
end
module_function :decorate
end
a = []
Decorator.decorate(a) {
def push(*args)
puts "They are pushing stuff on us *again*!"
super
end
}
a.push 1, 2, 3