From: Carolyn Grant Date: 2012-11-11T22:18:21+09:00 Subject: Re: Instance name of a class/object? unknown wrote in post #1083928: > Am 11.11.2012 10:24, schrieb sto.mar@web.de: >> Am 11.11.2012 05:21, schrieb Carolyn Grant: >>> Hi! I'm quite new to Ruby, and am quite confused about instance names. > >>> basic_config = MySettings.new # Picks up & processes basic_config.yml >>> adv_config = MySettings.new # Picks up & processes adv_config.yml > >> config = MySettings.new('basic_config') > > If you have lots of config objects you then could also use an array > or a hash that contains all of them: > > config[:basic] = MySettings.new('basic_config') > config[:adv] = MySettings.new('adv_config') I started with that, and wondered if there was a "better way". :-) There doesn't seem to be, so I'm rethinking the problem and coming up with a different solution. (I have no idea what that might be, at the moment... Probably the duplicate-looking syntax I was trying to get away from.) Thanks! -- Posted via http://www.ruby-forum.com/.