Skip to content

Instantly share code, notes, and snippets.

@mattn
Created March 26, 2014 09:14
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 mattn/9779420 to your computer and use it in GitHub Desktop.
Save mattn/9779420 to your computer and use it in GitHub Desktop.
class Module
def module_function(*args)
args.each do |x|
self.class.send(:define_method, x) {|*args| Class.new.send(:include, self).new.send(x, *args)}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment