On 25-jun-2006, at 16:17, Roger Johansson wrote:
>
> So, will it be a true mixin , or just a redirection mixin?
The mixin works with the methods and instance variables available on
the bearing instance
module LengthDisplay
def show
puts "Length is #{@len}"
end
end
class One
include LengthDisplay
attr_accessr :len
end
This way One will get a show method from the mixin, but you still can
override the method in the class to get more refined behavior.
It's not copied - so if you change the method in the module it's
going to change for all the bearing classes as well.
--
Julian 'Julik' Tarkhanov
please send all personal mail to
me at julik.nl