Roger Johansson wrote:
> How are the mixins implemented in Ruby?
>
> are the code in the mixin module "injected" into the target class?
>
> eg:
> consumer --call--> Taget
>
>
> or will the mixin related stuff live in some separate object and the
> target just redirects its calls to the mixin object?
>
> eg:
> consumer --call--> Target --redirect call--> mixin
>
>
> So, will it be a true mixin , or just a redirection mixin?

You say "true" like non-"redirectrion" is a bad thing. Actually it is a
good thing. Ruby mixins work by using a proxy class which is added to
the inheritance chain, then the mixin module is tied to that proxy
class. The effect is essentially:

  class AClass < Mixin1 < Mixin2 ... < SuperClass

but it does not require actual subclassing. Eg.

  module AMixin
    def f; "f"; end
  end

  class AClass
    include AMixin
    def f; "f" + super ; end
  end

  AClass.new.f  #=> "ff"

HTH,
T.