Add workarounds for 3rd parties not respecting Class#name

This commit is contained in:
Markus Schirp 2013-06-24 22:30:25 +02:00
parent 4bd0123750
commit 17e184efbb

View file

@ -52,6 +52,24 @@ module Mutant
end
end
# Test for bogus class
#
# FIXME: Remove this hack once bogus is fixed!
#
# @param [Object] object
#
# @return [true]
# if is a bogous class
#
# @return [false]
# otherwise
#
# @api private
#
def self.bogous?(object)
defined?(Bogus::Fake) && object == Bogus::Fake
end
# Yield scope if name matches pattern
#
# @param [Module,Class] scope
@ -61,6 +79,10 @@ module Mutant
# @api private
#
def emit_scope(scope)
return if self.class.bogous?(scope)
name = scope.name
# FIXME Fix nokogiri!
return unless name.kind_of?(String)
if pattern =~ scope.name
yield scope
end