Yes of course. You can mix BleeTestinto an object:
o = Object.new
o.extend BleeTest
o.meth
Or you can mix BleeTestinto a class:
class C
include BleeTest
end
o = C.new
o.meth
Indeed, the first form can also be expressed through the second form:
o = Object.new
class << o
include BleeTest
end
o.meth
That is, in the end, the whole point of modules in Ruby: serves as mixins for linking objects and classes.
source
share