builder
builder copied to clipboard
Blankslate Ruby 3.0 compatibility
Testing with Ruby 3.0, I observe the following error:
$ ruby -Ilib:test -e 'Dir.glob "./test/test_blan*.rb", &method(:require)' -- -n /test_late_included_module_in_kernel_is_ok/
Run options: -n /test_late_included_module_in_kernel_is_ok/ --seed 30445
# Running:
F
Finished in 0.000934s, 1070.2879 runs/s, 1070.2879 assertions/s.
1) Failure:
TestBlankSlate#test_late_included_module_in_kernel_is_ok [/builddir/build/BUILD/builder-3.2.4/usr/share/gems/gems/builder-3.2.4/test/test_blankslate.rb:149]:
NoMethodError expected but nothing was raised.
1 runs, 1 assertions, 1 failures, 0 errors, 0 skips
I think this is probably related to the ruby-core#9573 and this fixes the test case:
$ git diff
diff --git a/lib/blankslate.rb b/lib/blankslate.rb
index 7ea1864..b974f40 100644
--- a/lib/blankslate.rb
+++ b/lib/blankslate.rb
@@ -129,7 +129,7 @@ class Module
alias blankslate_original_append_features append_features
def append_features(mod)
result = blankslate_original_append_features(mod)
- return result if mod != Object
+ return result if (mod != Object && mod != Kernel)
instance_methods.each do |name|
BlankSlate.hide(name)
end
However, I am not quite sure this is the right fix.
Fixed in https://github.com/rails/builder/pull/15