Ruby's Include and Extend

Ruby's mixin is quite slick. But I was confused by include and extend for a while until I stumble upon this posting Extending your include knowledge of Ruby

Both include and extend are used for mixing-in module methods. "extend" adds methods from a module into a class as class methods. "include" adds methods from a module into a class as instance methods.

Do not attempt to include or extend another Class. Say, you have:

class ClassA
end

Next, try to include or extend ClassA. The examples below will fail:

class ClassB
include ClassA
end

class ClassB
end
b = ClassB.new
b.extend ClassA

Both examples will give you error "TypeError: wrong argument type Class (expected Module)".

 

Comments

include y extend

Me podrian explicar claramente cada uno de estos conceptos:

include:

extend:

Ya ke no los entiendo perfectamente por favor?