Skip to content

Instantly share code, notes, and snippets.

@Ejhfast
Created December 29, 2010 16:07
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 Ejhfast/758674 to your computer and use it in GitHub Desktop.
Save Ejhfast/758674 to your computer and use it in GitHub Desktop.
Ruby send usage
# This is what we did
self.class.send :define_method, symbol, &block
# This, although seemingly equivalent, would not work
# because define_method is private
define_method symbol, &block
# Another example of using send
[1,2,3].first # is equivalent to
[1,2,3].send(:first)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment