lib/unextendable/object.rb in unextendable-0.1.0 vs lib/unextendable/object.rb in unextendable-0.1.1
- old
+ new
@@ -24,15 +24,17 @@
add_extended_module mod
super(mod)
end
end
- def unextend(*modules)
+ def unextend(*modules, &block)
if modules.empty?
- meta_class.extended_modules.delete_if{|mod| mod.unextendable?}
+ meta_class.extended_modules.delete_if do |mod|
+ mod.unextendable? if !block_given? || block.call(mod)
+ end
else
modules.each do |mod|
- meta_class.extended_modules.delete mod
+ meta_class.extended_modules.delete mod if !block_given? || block.call(mod)
end
end
end
private
\ No newline at end of file