lib/core/facets/module/conflict.rb in facets-2.4.4 vs lib/core/facets/module/conflict.rb in facets-2.4.5

- old
+ new

@@ -17,39 +17,46 @@ # # CREDIT: Thomas Sawyer # CREDIT: Robert Dober def conflict?(other) + common_ancestor = (ancestors & other.ancestors).first c = [] c += (public_instance_methods(true) & other.public_instance_methods(true)) c += (private_instance_methods(true) & other.private_instance_methods(true)) c += (protected_instance_methods(true) & other.protected_instance_methods(true)) + c -= common_ancestor.public_instance_methods(true) + c -= common_ancestor.private_instance_methods(true) + c -= common_ancestor.protected_instance_methods(true) c.empty? ? false : c end #def conflict?(other) # c = instance_methods & other.instance_methods # c.empty ? false : c #end # Like #conflict?, but checks only public methods. - def public_conflict?(other) + common_ancestor = (ancestors & other.ancestors).first c = public_instance_methods(true) & other.public_instance_methods(true) + c -= common_ancestor.public_instance_methods(true) c.empty? ? false : c end # Like #conflict?, but checks only private methods. - def private_conflict?(other) + common_ancestor = (ancestors & other.ancestors).first c = private_instance_methods(true) & other.private_instance_methods(true) + c -= common_ancestor.private_instance_methods(true) c.empty? ? false : c end # Like #conflict?, but checks only protected methods. - def protected_conflict?(other) + common_ancestor = (ancestors & other.ancestors).first c = protected_instance_methods(true) & other.protected_instance_methods(true) + c -= common_ancestor.protected_instance_methods(true) c.empty? ? false : c end end