Hi, How do you access an instance variable within a mixin method? I can think of 2 ways, but both seem problematic.
Have the mixin method access the instance variable directly as any class method would, e.g self.text. Problem with this is that it places restrictions on where the mixin method can be used, and forces the class doing the mixing to have a particular instance method named in a particular way.
Pass the instance variable as a parameter to the mixin method, which would result in code like this:
example
self.do_something(self.text)
or
@thing.do_something(@thing.text)
which looks nasty to me, and does't conform to the principles of object orientation.
Is there any other way to do it?, am i right to be concerned?
Dave