summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-array-ext/mrblib/array.rb
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-03-28 23:18:55 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-03-28 23:18:55 +0900
commit97f22c9516c2fdf2c0dc93099e20fc110ac9456d (patch)
tree8b9818be4712fe1f198ead6ad89babd14df58895 /mrbgems/mruby-array-ext/mrblib/array.rb
parent5625104291b287e1b9c7cb858e74e4396cd13b81 (diff)
downloadmruby-97f22c9516c2fdf2c0dc93099e20fc110ac9456d.tar.gz
mruby-97f22c9516c2fdf2c0dc93099e20fc110ac9456d.zip
Array#reverse_each should return Enumerator; ref #1968
Diffstat (limited to 'mrbgems/mruby-array-ext/mrblib/array.rb')
-rw-r--r--mrbgems/mruby-array-ext/mrblib/array.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/mrbgems/mruby-array-ext/mrblib/array.rb b/mrbgems/mruby-array-ext/mrblib/array.rb
index feec10ead..d29aef325 100644
--- a/mrbgems/mruby-array-ext/mrblib/array.rb
+++ b/mrbgems/mruby-array-ext/mrblib/array.rb
@@ -204,6 +204,8 @@ class Array
# for efficiency
def reverse_each(&block)
+ return to_enum :sort_by unless block_given?
+
i = self.size - 1
while i>=0
block.call(self[i])