methods/super_in_a_block_of_a_class_named_later.rb
tests/_examples/methods/super_in_a_block_of_a_class_named_later.rb in the metorex repository.
class Reentrant
def synchronize
yield
end
end
module Definitions
def value = :from_module
end
Outer = Class.new
Outer.send(:include, Definitions)
Outer.send(:define_method, :value) { Reentrant.new.synchronize { super(&nil) } }
Inner = Class.new(Outer)
Inner.send(:include, Module.new)
p Inner.new.value
Output:
:from_module