aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/test/connection/stream_test.rb
diff options
context:
space:
mode:
authorJeremy Daer <jeremydaer@gmail.com>2016-04-18 22:46:29 -0700
committerJeremy Daer <jeremydaer@gmail.com>2016-04-18 22:53:20 -0700
commit7ad4690b2149fbb23faa179c21698b92ff383c73 (patch)
tree1206697be3e452ec423027a05fade291d9f50dc8 /actioncable/test/connection/stream_test.rb
parentf2f2d64429c674a9134bfd011995c30c6cc34dab (diff)
downloadrails-7ad4690b2149fbb23faa179c21698b92ff383c73.tar.gz
rails-7ad4690b2149fbb23faa179c21698b92ff383c73.tar.bz2
rails-7ad4690b2149fbb23faa179c21698b92ff383c73.zip
Ruby 2.4: compat with new Array#sum
Ruby 2.4 introduces `Array#sum`, but it only supports numeric elements, breaking our `Enumerable#sum` which supports arbitrary `Object#+`. To fix, override `Array#sum` with our compatible implementation. Native Ruby 2.4: %w[ a b ].sum # => TypeError: String can't be coerced into Fixnum With `Enumerable#sum` shim: %w[ a b ].sum # => 'ab' We tried shimming the fast path and falling back to the compatible path if it fails, but that ends up slower even in simple causes due to the cost of exception handling. Our only choice is to override the native `Array#sum` with our `Enumerable#sum`.
Diffstat (limited to 'actioncable/test/connection/stream_test.rb')
0 files changed, 0 insertions, 0 deletions