Skip to content

Instantly share code, notes, and snippets.

@bjfish
Created June 28, 2016 13:15
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 bjfish/22ae516a69ce906fdcc6538f88bce6ef to your computer and use it in GitHub Desktop.
Save bjfish/22ae516a69ce906fdcc6538f88bce6ef to your computer and use it in GitHub Desktop.
for Hash
def to_proc
Proc.new do |key=undefined|
raise ArgumentError, "wrong number of arguments (given 0, expected 1)" if undefined.equal?(key)
self[key]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment