相关疑难解决方法(0)

如何在Ruby中重新定义Fixnum的+(plus)方法并保留原始+功能?

这引发了我在1.9.2 Ruby中的SystemStackError(但在Rubinius中工作):

class Fixnum
  def +(other)
   self + other * 2
  end
end
Run Code Online (Sandbox Code Playgroud)

但没有super了+(基于其他错误).

我如何访问原始+功能?

ruby rubinius yarv super

7
推荐指数
1
解决办法
5601
查看次数

标签 统计

rubinius ×1

ruby ×1

super ×1

yarv ×1