未验证 提交 cd9d5c11 编写于 作者: Y yui-knk 提交者: Jeremy Daer

Remove `Array#sum` method before override it

To suppress warning ('warning: method redefined; discarding old sum')
remove the method before override it.
Signed-off-by: NJeremy Daer <jeremydaer@gmail.com>
上级 643cac08
......@@ -112,6 +112,8 @@ def sum(identity = 0)
# just calling the compat method in the first place.
if Array.instance_methods(false).include?(:sum) && !(%w[a].sum rescue false)
class Array
remove_method :sum
def sum(*args) #:nodoc:
# Use Enumerable#sum instead.
super
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册