--1926193751-1060423635-12545063299363 Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-1060423635-1254506329=:19363" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1926193751-1060423635-12545063299363 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8BIT Hi -- On Sat, 3 Oct 2009, Jesù¸ Gabriel y GaláÏ wrote: > On Fri, Oct 2, 2009 at 4:54 PM, James French > <James.French / naturalmotion.com> wrote: >> Hi, >> >> I want to be able to do operations to a selection of objects, something like this: >> >> class Config >> ttr_accessor :name >> end >> >> class ConfigSelection >> >> ef initialize(*configs) >> configs onfigs >> nd >> >> ef name ) >> configs.each{|c| c.name } >> nd >> >> end >> >> a onfig.new >> a.name a" >> >> b onfig.new >> b.name b" >> >> s onfigSelection.new(a, b) >> s.name s" >> >> >> I was wondering if there might be a more elegant way of doing this, without having to explicitly duplicate all of Config's attributes in ConfigSelection? > > This is a way, with the restriction that it only checks instance > methods defined in the class: > > irb(main):015:0> c onfig.new >