Skip to content

Instantly share code, notes, and snippets.

@patmaddox
Created May 18, 2009 19:52
Show Gist options
  • Select an option

  • Save patmaddox/113704 to your computer and use it in GitHub Desktop.

Select an option

Save patmaddox/113704 to your computer and use it in GitHub Desktop.
module Muahaha
def self.included(target)
target.class_eval do
instance_methods.each do |m|
next if m.to_s.include?("__") || m.to_s == "send"
alias_method "old_#{m}", m
eval <<-END
def #{m}(*args, &block)
return if rand > 0.95
send("old_#{m}", *args, &block)
end
END
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment