Skip to content

Commit

Permalink
Enumerable#reverse_each should not rely on mruby-array-ext gem
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Mar 24, 2014
1 parent c326ab8 commit aa5920a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mrbgems/mruby-enum-ext/mrblib/enum.rb
Expand Up @@ -518,9 +518,12 @@ def each_with_object(obj=nil, &block)
#

def reverse_each(&block)
ary = []
self.each {|*val| ary.push(val.__svalue) }
ary.reverse_each(&block)
ary = self.to_a
i = ary.size - 1
while i>=0
block.call(ary[i])
i -= 1
end
self
end
end

0 comments on commit aa5920a

Please sign in to comment.