Skip to content

Instantly share code, notes, and snippets.

@cgiacomi
Created July 3, 2012 14:21
Show Gist options
  • Save cgiacomi/3040002 to your computer and use it in GitHub Desktop.
Save cgiacomi/3040002 to your computer and use it in GitHub Desktop.
Set a function as a value in a Hash, and how to call it with arguments
def myfunc(arg)
puts arg
end
dict = {}
dict['greet'] = method(:myfunc)
f = dict['greet']
f.call('Hello World')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment