# http://rubinius.lighthouseapp.com/projects/5089/tickets/614-calling-a-class-method-on-an-object-s-metaclass-should-invoke-the-class-method-of-the-object-s-class#ticket-614-5 class Object # The hidden singleton lurks behind everyone def metaclass; class << self; self; end; end def meta_eval(&blk) metaclass.instance_eval(&blk) end # Adds methods to a metaclass def meta_def name, &blk meta_eval { define_method name, &blk } end end class B end b = B.new # false in Rubinius, true in MRI, JRuby p b.metaclass.superclass.object_id == B.metaclass.object_id b.meta_def(:cheese) {'cheshire'} # false in all implementation p b.metaclass.superclass.object_id == B.metaclass.object_id