Skip to content

Commit

Permalink
'Enumerable#reverse_each' backport for Ruby 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
epitron committed Jun 26, 2015
1 parent e57ff8a commit 2f0b539
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/epitools/core_ext/enumerable.rb
Expand Up @@ -36,6 +36,15 @@ def skip(n)
end
end

#
# Add reverse_each to old Ruby versions
#
unless defined? reverse_each
def reverse_each
to_a.to_enum(:reverse_each)
end
end

#
# Split this enumerable into chunks, given some boundary condition. (Returns an array of arrays.)
#
Expand Down

0 comments on commit 2f0b539

Please sign in to comment.