module Bar
def my_method
'inside module'
end
end
class Foo
include Bar
def my_method
'inside class'
end
end
x = Foo.new
p x.my_method
> 'inside class'
Time to prepend !
module Bar
def my_method
'inside module'
end
end
class Foo
prepend Bar
def my_method
'inside class'
end
end
x = Foo.new
p x.my_method
> 'inside module'
Want more ? Look the movie (10min)