Mixin is a class that is mixed with a module. In other words the implementation of the class and module are joined, intertwined, combined, etc. A mixin is a different mechanism to the extend construct used to add concrete implementation to a class. With a mixin you can extend from a module instead of a class.
Module is a degenerate abstract class. A module can’t be instantiated and no class can directly extend it but a module can fully implement methods. A class can leverage the implementation of a module by including the module’s methods. A module can define methods that can be shared in different and separate classes either at the class or instance level.
module Abstract def run @value * 2 end end class Child include Abstract def initialize(value) @value = value end end c = Child.new(20) puts c.run
Must Read Link:
==> This link would also help you understand what does self.included and class_eval and instance_eval does??