aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authoryui-knk <spiketeika@gmail.com>2016-04-25 10:11:41 +0900
committerJeremy Daer <jeremydaer@gmail.com>2016-04-24 22:05:24 -0500
commitcd9d5c115012e3e8644b359594fdd75459f43dfa (patch)
treebaa01a9ad44dc85ad349a897141de683cded7d2b /activesupport
parent643cac08a325243cab21d870c68a9c4088c58380 (diff)
downloadrails-cd9d5c115012e3e8644b359594fdd75459f43dfa.tar.gz
rails-cd9d5c115012e3e8644b359594fdd75459f43dfa.tar.bz2
rails-cd9d5c115012e3e8644b359594fdd75459f43dfa.zip
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: Jeremy Daer <jeremydaer@gmail.com>
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/enumerable.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/enumerable.rb b/activesupport/lib/active_support/core_ext/enumerable.rb
index 0e03f7d7be..941f20c19d 100644
--- a/activesupport/lib/active_support/core_ext/enumerable.rb
+++ b/activesupport/lib/active_support/core_ext/enumerable.rb
@@ -112,6 +112,8 @@ end
# 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