@@ -103,8 +103,11 @@ def puts x; old_puts x end
103103end
104104
105105class Module
106+ alias :old_include :include
106107 def module_eval ; end
107- def include ; end
108+ def include x
109+ old_include x
110+ end
108111 def prepend ; end
109112 def private ; end
110113end
@@ -447,7 +450,7 @@ def m5
447450ConditionalInstanceMethods . new . m3 # currently unable to resolve
448451ConditionalInstanceMethods . new . m4 # currently unable to resolve
449452ConditionalInstanceMethods . new . m5 # NoMethodError
450- exit
453+
451454EsotericInstanceMethods = Class . new do
452455 [ 0 , 1 , 2 ] . each do
453456 def foo
@@ -483,3 +486,39 @@ def singleton
483486end
484487
485488ExtendSingletonMethod . singleton # currently unable to resolve
489+
490+ module ProtectedMethodInModule
491+ protected def foo
492+ puts "ProtectedMethodInModule#foo"
493+ end
494+ end
495+
496+ class ProtectedMethods
497+ include ProtectedMethodInModule
498+
499+ protected def bar
500+ puts "ProtectedMethods#bar"
501+ end
502+
503+ def baz
504+ foo
505+ bar
506+ ProtectedMethods . new . foo
507+ ProtectedMethods . new . bar
508+ end
509+ end
510+
511+ ProtectedMethods . new . foo # NoMethodError
512+ ProtectedMethods . new . bar # NoMethodError
513+ ProtectedMethods . new . baz
514+
515+ class ProtectedMethodsSub < ProtectedMethods
516+ def baz
517+ foo
518+ ProtectedMethodsSub . new . foo
519+ end
520+ end
521+
522+ ProtectedMethodsSub . new . foo # NoMethodError
523+ ProtectedMethodsSub . new . bar # NoMethodError
524+ ProtectedMethodsSub . new . baz
0 commit comments