From: Markus Date: 2004-09-10T23:15:44+09:00 Subject: Re: Names for these setting helper methods In my code I call the first one (or rather, its analog, which takes a hash) "Object#absorb" and would probably call the second one something like "Object#soak_in". class Object def exude(*fields=self.instance_variables) fields.collect_hash { |m| self.instance_variable_get( m ) } end def absorb(field_values) field_values.each_pair { |k,v| self.instance_variable_set( k,v ) } end def soak_in(field_values) field_values.each.pair { |k,v| self.send( "#@{k}=", v ) } end end WARNING: ABOVE CODE TYPED FROM MEMORY WITH A TODDLER'S HELP -- MarkusQ On Thu, 2004-09-09 at 19:19, T. Onoma wrote: > Can anyone think of better names for these? > > class Object > > def instance_from(f, *msgs) > msgs.each { |m| self.instance_variable_set( "@#{m}", f.send(m) ) } > end > > def set_from(f, *msgs) > msgs.each { |m| self.send( "#{m=}", f.send(m) ) } > end > > end >