Eustaquio Rangel de Oliveira Jr. wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > | it's strange your model :-))) > > Hey Guy! > > Thanks, it worked, but too much for a newbie, I need to take a look and > learn with this now. You scared me ahahah, I told you I was a newbie. :-) No, you scared not only becuase you are newbie, but because you were answered by Guy :-) Keep working on Ruby for many more years and he will still scare you ;-) > I didn't know that there was "self" on Ruby, for example. :-) > And what about that instance_eval and inherited there? Ahhh. :-) > > Thanks! :-) Have fun ! -- shanko > | > | class CarBuilder > | def self.inherited(kl) > | kl.instance_eval { @total_of_cars = 0 } > | super > | end > | > | def build > | puts "#{self.class} building another car ..." > | self.class.instance_eval { @total_of_cars += 1 } > | end > | > | def total_of_cars > | "#{self.class} built #{self.class.instance_eval { @total_of_cars > }} cars" > | end > | end > | > | class Honda < CarBuilder > | end > | > | class Ford < CarBuilder > | end > > - ---------------------------- > Eust?quio "TaQ" Rangel > eustaquiorangel / yahoo.com > http://beam.to/taq > Usu?rio GNU/Linux no. 224050 > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.6 (GNU/Linux) > Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org > > iD8DBQFB1Aokb6UiZnhJiLsRAs0oAKC2uZAh8MB2amkV96JtIqa3vgQ6xACfUn3Y > EV+7wuTrWDyD8tq1LxBaV9w= > =DDYu > -----END PGP SIGNATURE----- > >