Monday, 15 August 2011

ruby - What does this extend do? -



ruby - What does this extend do? -

given example:

module module b def foo puts 'foo' end extend a::b end end

what extend a::b do?

it extends module a::b itself, create method foo available on module object a::b itself.

without line, not able phone call a::b.foo in code.

you may want read more on ruby extend amodule vs include amodule.

ruby

No comments:

Post a Comment