Add workarounds for 3rd parties not respecting Class#name
This commit is contained in:
parent
4bd0123750
commit
17e184efbb
1 changed files with 22 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue