Hi,
I want to be able to do operations to a selection of objects, something like this:
class Config
attr_accessor :name
end
class ConfigSelection
def initialize(*configs)
@configs = configs
end
def name=(n)
@configs.each{|c| c.name = n}
end
end
a = Config.new
a.name = "a"
b = Config.new
b.name = "b"
s = ConfigSelection.new(a, b)
s.name = "s"
I was wondering if there might be a more elegant way of doing this, withoutaving to explicitly duplicate all of Config's attributes in ConfigSelection?
Cheers,
James