From: Mark Noworolski Date: 2006-06-11T11:38:56+09:00 Subject: Dynamic class change? I have a stream I'm listening to that lots of similar things speak on, each of which also identifies itself with a unique MAC. Say, I have 3 objects organized something like this: Class Nic End Class Nic2 < Nic Etc. End Class Nic3 < Nic2 Etc. End As time passes, when I hear a new MAC start talking, I dynamically create a corresponding object. So, if the first thing I hear is something a Nic says, a Nic object can spring into existence, ditto for Nic2, etc. So far, seems reasonable. However, the similar things will sometimes appear as a Nic, then say something new and exciting that indicates that they are actually Nic2 objects (or Nic3, for example). The simple/crude solution is just to have one nic object with a '@type' class variable that can get changed once new information appears. Also the @type variable could be queried to figure out what the object is/does. But this just doesn't seem like the ruby way. Is there something obvious I should be doing that is sensible and cleaner? The objective is for the calling routine, over time, to know what type of objects it is talking to (and to efficiently collect the various types to perform operations on). Thanks, Mark -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.8.3/360 - Release Date: 6/9/2006