Skip to content

Instantly share code, notes, and snippets.

@mattwynne
Created April 18, 2009 21:34
Show Gist options
  • Select an option

  • Save mattwynne/97793 to your computer and use it in GitHub Desktop.

Select an option

Save mattwynne/97793 to your computer and use it in GitHub Desktop.
module Monkey
def self.extend_every(args)
class_to_extend = args.keys.first
module_to_extend_with = args.values.first
class_to_extend.instance_eval <<-PATCH
def new(*args)
super(*args).extend(#{module_to_extend_with})
end
PATCH
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment