Skip to content
Permalink
Browse files

Merge pull request #546 from kostya/master

Array#reverse, reverse_each
  • Loading branch information
alex committed Mar 24, 2013
2 parents 5110785 + 93dda6c commit a270d98e471aa004be8dc895fff196b1be5f7050
@@ -298,4 +298,13 @@ def each_index(&block)
0.upto(size - 1, &block)
self
end

def reverse
self.dup.reverse!
end

def reverse_each(&block)
reverse.each(&block)
self
end
end
@@ -1,5 +1 @@
fails:Array#reverse_each traverses array in reverse order and pass each element to block
fails:Array#reverse_each returns self
fails:Array#reverse_each yields only the top level element of an empty recursive arrays
fails:Array#reverse_each yields only the top level element of a recursive array
fails:Array#reverse_each returns an Enumerator if no block given

This file was deleted.

@@ -279,3 +279,10 @@ def method_clear(self, space):
def method_sort(self, space, block):
RubySorter(space, self.items_w, sortblock=block).sort()
return self

@classdef.method("reverse!")
@check_frozen()
def method_reverse_i(self, space):
self.items_w.reverse()
return self

0 comments on commit a270d98

Please sign in to comment.
You can’t perform that action at this time.