Skip to content

Instantly share code, notes, and snippets.

@avdi
Created October 2, 2015 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avdi/33cacf9e195987effd06 to your computer and use it in GitHub Desktop.
Save avdi/33cacf9e195987effd06 to your computer and use it in GitHub Desktop.
class Array
def to_proc
->(receiver, *args) {
receiver.public_send(*self, *args)
}
end
end
data = [{'x'=>1}, {'x'=>2},{'x'=>'foo'}]
data.map(&[:[], 'x'])
# => [1, 2, "foo"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment