Created
February 19, 2014 17:16
-
-
Save jredville/9096707 to your computer and use it in GitHub Desktop.
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
def enumerable_select_with_index(arr, &block) | |
[].tap do |new_arr| | |
arr.each_with_index do |item, index| | |
new_arr.push item if block.call item, index | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment