Created
March 13, 2015 17:03
-
-
Save sirkosi/e2fcab631f4dbe328700 to your computer and use it in GitHub Desktop.
reverse each with original index.. don't ask..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array | |
def reverse_each_with_original_index | |
size_of_array = self.size | |
self.reverse.each_with_index do |object, i| | |
yield object, size_of_array - (i+1) | |
end | |
end | |
end | |
[:a, :b, :c].reverse_each_with_original_index{|object, index| puts "object: #{object} index: #{index}" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment