extract: check if DependencyCollector::Compat is defined before monkey-patch
This commit is contained in:
parent
ad0f9d603f
commit
b1120dd404
@ -44,11 +44,13 @@ def with_monkey_patch
|
|||||||
define_method(:parse_symbol_spec) { |*| }
|
define_method(:parse_symbol_spec) { |*| }
|
||||||
end
|
end
|
||||||
|
|
||||||
DependencyCollector::Compat.class_eval do
|
if defined?(DependencyCollector::Compat)
|
||||||
if method_defined?(:parse_string_spec)
|
DependencyCollector::Compat.class_eval do
|
||||||
alias_method :old_parse_string_spec, :parse_string_spec
|
if method_defined?(:parse_string_spec)
|
||||||
|
alias_method :old_parse_string_spec, :parse_string_spec
|
||||||
|
end
|
||||||
|
define_method(:parse_string_spec) { |*| }
|
||||||
end
|
end
|
||||||
define_method(:parse_string_spec) { |*| }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
yield
|
yield
|
||||||
@ -81,10 +83,12 @@ ensure
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
DependencyCollector::Compat.class_eval do
|
if defined?(DependencyCollector::Compat)
|
||||||
if method_defined?(:old_parse_string_spec)
|
DependencyCollector::Compat.class_eval do
|
||||||
alias_method :parse_string_spec, :old_parse_string_spec
|
if method_defined?(:old_parse_string_spec)
|
||||||
undef :old_parse_string_spec
|
alias_method :parse_string_spec, :old_parse_string_spec
|
||||||
|
undef :old_parse_string_spec
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user