我想覆盖发送对象,就像这样
class Object
@@object_send = self.instance_method( :send )
def send *args
@@object_send.bind( self ).call *args
end
end
或者
class Object
def send *args
__send__ *args
end
end
或者
class Object
alias_method :old_send, :send
def send *args
old_send *args
end
end
但是所有这些选项都会导致出现此错误
/opt/local/lib/ruby1.9/gems/1.9.1/gems/minitest-2.8.1/lib/minitest/unit.rb:871:in `block in process_args': unsupported argument type: Integer (ArgumentError)
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/minitest-2.8.1/lib/minitest/unit.rb:862:in `new'
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/minitest-2.8.1/lib/minitest/unit.rb:862:in `process_args'
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/minitest-2.8.1/lib/minitest/unit.rb:912:in `_run'
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/minitest-2.8.1/lib/minitest/unit.rb:905:in `run'
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/minitest-2.8.1/lib/minitest/unit.rb:685:in `block in autorun'
有什么我可以做的吗?
更新:尝试更新到 2.9.1 但这并没有解决问题