lib/blockenspiel/unmixer_rubinius.rb in blockenspiel-0.4.1-java vs lib/blockenspiel/unmixer_rubinius.rb in blockenspiel-0.4.2
- old
+ new
@@ -39,21 +39,23 @@
# :stopdoc:
module Unmixer
+ @old_metaclass = ''.respond_to?(:metaclass)
+
# Unmix a module from an object in Rubinius.
#
# This implementation is based on unreleased code from the Mixology
# source, written by Dan Manges.
# See http://github.com/dan-manges/mixology
#
# It has been stripped down and modified for compatibility with the
# Rubinius 1.0 release.
def self.unmix(obj_, mod_) # :nodoc:
- last_super_ = obj_.metaclass
+ last_super_ = @old_metaclass ? obj_.metaclass : obj_.singleton_class
this_super_ = last_super_.direct_superclass
while this_super_
if (this_super_ == mod_ || this_super_.respond_to?(:module) && this_super_.module == mod_)
_reset_method_cache(obj_)
last_super_.superclass = this_super_.direct_superclass