From: Mark Probert Date: 2002-05-04T05:04:58+09:00 Subject: ruby idiom check I have a class that telnets into a number of different systems. Each of these systems has it own set of defaults such as ports, address, username, and so on. The thought I had to abstract this was (1) to sub-class or (2) to use Struct to contain the differences, a la: SysDefs = Struct::new(:name, :val) $OneDef = SysDefs::new('type 1', 123) $TwoDef = SysDefs::new('type 2', 234) class BasicSys attr_reader :name, :val, :stuff def initialize(key=1) @def = SysDefs::new case key when 1 @def = $OneDef when 2 @def = $TwoDef end @name = @def.name @val = @def.val @stuff = nil end end Any thoughts as to which is the preferred design choice and why? -mark ----- Mark Probert GNPS - Optera Metro 3000 Tel (613) 768-1082 (ESN: 398-1082) Mob (613) 715-2045 email: probertm@nortelnetworks.com