2010/3/15 Walton Hoops <walton / vyper.hopto.org>:
> On 3/15/2010 9:11 AM, Andrea Dallera wrote:
>> I'm sorry, I looked before posting and i couldn't find anything. I'm
>> looking now too and still I can't find it, so if you maybe have a
>> pointer to that it would be really nice. Sorry for spamming.
>>
> Found it: http://www.ruby-forum.com/topic/204105
> While it does offer some methods you might use, I highly recommend not
> trying to solve the problem this way. super' is an expected part of
> sub-classing, and there may be instances in which the sub-classer does
> *not* want your initializer to run.     
> do, I might be inclined to solve it with the factory approach. So
> instead those using your framework would do something like:
> MyFactory.getInstance() do
> # user defines their behavior here
> end
>
> which returns an already initialized object.

I agree: calling super is the default method for making sure super
classes are initialized properly.  I would stick to that rather than
inventing some magic behind the scenes.  For exampl, if you override
#new to do what OP wants (which is possible) measures should be taken
to not break if someone actually invokes super in their #initialize.

Kind regards

robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/