Last active
May 1, 2016 18:49
-
-
Save jm-maniego/63095554dde8d440af23db24c760004c to your computer and use it in GitHub Desktop.
Yup, it's useless
This file contains hidden or 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 | |
proc {|x| inject(x) { |a, y| a.send(y) } } | |
end | |
end | |
class String | |
def to_proc | |
split(/\./).to_proc | |
end | |
end | |
strings_arr = ["AbcDef", "GhiJkl", "MnoPqr"] | |
strings_arr.map(&"underscore.upcase") | |
#=> ["ABC_DEF", "GHI_JKL", "MNO_PQR"] | |
strings_arr.map(&["underscore", "upcase"]) | |
#=> ["ABC_DEF", "GHI_JKL", "MNO_PQR"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment