Skip to content

Instantly share code, notes, and snippets.

@jballanc
Last active August 29, 2015 14:16
Show Gist options
  • Save jballanc/3a36220d9d13fd6fc456 to your computer and use it in GitHub Desktop.
Save jballanc/3a36220d9d13fd6fc456 to your computer and use it in GitHub Desktop.
Crazy...
dislike = ->() {}
like = ->(thing = define_method(:confused, &dislike) && "ice cream") { puts "I like #{thing}" }
dislike = ->(thing = define_method(:confused, &like) && "broccoli") { puts "I don't like #{thing}" }
define_method(:confused, &like)
confused("ayran")
confused
confused("homework")
confused
confused("kunefe")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment