How can I let a module to be included by another module look for a constant inside the including module? In other words, how can I make B.foo and D.foo below give the expected results?
module A
module_function
public
def foo; C end
end
module B
extend A
C = "foo in B"
end
module D
extend A
C = "foo in D"
end
B.foo #=> (Expected) "foo in B"
D.foo #=> (Expected) "foo in D"
You need to tell it to lookup
Cin the context of whereAisextended in: