Reputation: 9969
Given this example:
module A
module B
def foo
puts 'foo'
end
extend A::B
end
end
What does this extend A::B
do?
Upvotes: 0
Views: 60
Reputation:
It extends module A::B with itself, essentially make method foo
available on module object A::B
itself.
Without that line, you are not able to call A::B.foo
in your code.
You may want to read more on Ruby extend aModule
vs include aModule
.
Upvotes: 3