1 # Compliments to why for this:
2 # http://whytheluckystiff.net/articles/seeingMetaclassesClearly.html
5 # The hidden singleton lurks behind everyone
6 def metaclass; class << self; self; end; end
7 def meta_eval &blk; metaclass.instance_eval &blk; end
9 # Adds methods to a metaclass
10 def meta_def name, &blk
11 meta_eval { define_method name, &blk }
14 # Defines an instance method within a class
15 def class_def name, &blk
16 class_eval { define_method name, &blk }