Skip to content

Instantly share code, notes, and snippets.

@wrbs
Created August 26, 2013 23:50
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 wrbs/6348101 to your computer and use it in GitHub Desktop.
Save wrbs/6348101 to your computer and use it in GitHub Desktop.
Think you ruby likes you. Think again. Load it up into any program and you will have trouble displaying anything to the screen.
# Monkeypatching like a boss
class Array
def do_def(&block)
self.each do |method|
Kernel.send :define_method, method, &block
end
end
end
# Think you can print anything. You must be stupid
[:print, :printf, :puts].do_def do | *args |
nice_names = ["pony", "fairy"] # Fill in with your own words
i = Random.rand(nice_names.length)
$stdout.puts "I'm not printing anything for you. Do it yourself you lazy #{nice_names[i]}."
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment