Hi,
some newbie questions:
- How can/should I access a class constant from a mixin? The only thing I've
managed to get working is "const_get("name of const")".
- Is it possible to access protected methods from mixins? I'm trying to
create a mixin alike the following:
---
module StaticCreateMixin
def create_from(stuff)
obj = self.new
obj.my_stuff.<modifiying fn>!(stuff)
obj
end
end
class Foo
extend StaticCreateMixin
def my_stuff
@stuff
end
protected :my_stuff
end
f = Foo.static_create("some stuff")
---
(no, I can't pass the "some stuff" as parameter to Foo.initialize)
Thanks // Johan