Skip to content

Instantly share code, notes, and snippets.

@Sixeight
Created December 14, 2008 16:49
Show Gist options
  • Save Sixeight/35721 to your computer and use it in GitHub Desktop.
Save Sixeight/35721 to your computer and use it in GitHub Desktop.
# Class#meta..class
class Class
def method_missing(meth, *args)
unless meth.to_s =~ /\A((?:meta)+)class\z/
super
end
level = $1.gsub(/meta/).count
level.times.inject(self) {|klass, _| class << klass; self end }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment