From: Chris Olsen Date: 2008-07-16T13:07:34+09:00 Subject: Re: Is there a way to call include for an object instance? Trans wrote: > On Jul 15, 11:38�pm, Chris Olsen wrote: >> >> � def before_save >> � def scoring_percentage >> >> � end > Couple of ways. One is to use the singleton. > > def sport=(sport) > (class << self; self; end).class_eval %{ > include #{sport.capitalize}Stats > } > end > > But I think you might want to reconsider and use delegation instead. > > T. Thanks so much. To be honest I have no idea what the (class << self; self; end), but it will make for good reading :). I will look into the delegation as well. Thanks again. -- Posted via http://www.ruby-forum.com/.