Last active
August 29, 2015 14:02
-
-
Save bnorton/975a716d3833758028e0 to your computer and use it in GitHub Desktop.
Convert an array to a proc that applies its members in sequence to the given item
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 to_proc | |
->(item) do | |
self.each do|meth| | |
item = item.send meth | |
end | |
item | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simple Example: