Skip to content

Instantly share code, notes, and snippets.

@wrbs
Created August 26, 2013 23:50

Revisions

  1. logiblocs created this gist Aug 26, 2013.
    15 changes: 15 additions & 0 deletions evil.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    # 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