lib/unextendable/object.rb in unextendable-0.1.5 vs lib/unextendable/object.rb in unextendable-0.1.6

- old
+ new

@@ -10,23 +10,27 @@ end end def extend(*modules) modules.each do |mod| - wrap_unextendable_module mod if mod.unextendable? - add_extended_module mod + if respond_to?(:meta_class) + wrap_unextendable_module mod if mod.unextendable? + add_extended_module mod + end super(mod) end end def unextend(*modules, &block) - if modules.empty? - meta_class.extended_modules.delete_if do |mod| - unextend? mod, &block - end - else - modules.each do |mod| - meta_class.extended_modules.delete mod if unextend? mod, &block + if respond_to?(:meta_class) + if modules.empty? + meta_class.extended_modules.delete_if do |mod| + unextend? mod, &block + end + else + modules.each do |mod| + meta_class.extended_modules.delete mod if unextend? mod, &block + end end end end private \ No newline at end of file