1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/irb/helper.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
471 B
Ruby
Raw Normal View History

module IRB
module TestHelper
def self.without_rdoc(&block)
::Kernel.send(:alias_method, :old_require, :require)
::Kernel.define_method(:require) do |name|
raise LoadError, "cannot load such file -- rdoc (test)" if name.match?("rdoc") || name.match?(/^rdoc\/.*/)
::Kernel.send(:old_require, name)
end
yield
ensure
EnvUtil.suppress_warning { ::Kernel.send(:alias_method, :require, :old_require) }
end
end
end