------ art_3334_25331292.1120520412318 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi all. A while ago, I was playing with some network programming, and found that I wanted to have a class that would observe two other Observable classes. I could have done this by sending another parameter with notify_observers specifying which class the update came from -- but that is, to say the least, ugly. So I came up with this patch. (attached) What it does is allow you to append a paramter to add_observer. Observable will then take that paramater and use it instead of the default :update -- that means you can have one Observable class call #update_class1 on your class and have the next call #update_class2. Originally I kept the internal list of observers as an array and kept the method to send in a class variable, but that pollutes the namespace further and does not allow for multiple classes observing the same class to use different method names. So I moved the list of observers to a hash, that each class could have its own method called. Without further ado, I present The Patch. -- - nornagon ------ art_3334_25331292.1120520412318 Content-Type: text/plain; name="observer-patch.diff" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="observer-patch.diff" LS0tIG9ic2VydmVyLnJiCTIwMDUtMDctMDUgMDk6Mjg6MTQuNDUyMTE0MzUyICsxMDAwCisrKyBv YnNlcnZlci1uZXcucmIJMjAwNS0wNy0wNSAwOTozNjo0OS45ODc3NDEwMjQgKzEwMDAKQEAgLTEy MCwxMiArMTIwLDEyIEBACiAgICMgQWRkICtvYnNlcnZlcisgYXMgYW4gb2JzZXJ2ZXIgb24gdGhp cyBvYmplY3QuICtvYnNlcnZlcisgd2lsbCBub3cgcmVjZWl2ZQogICAjIG5vdGlmaWNhdGlvbnMu CiAgICMKLSAgZGVmIGFkZF9vYnNlcnZlcihvYnNlcnZlcikKLSAgICBAb2JzZXJ2ZXJfcGVlcnMg PSBbXSB1bmxlc3MgZGVmaW5lZD8gQG9ic2VydmVyX3BlZXJzCi0gICAgdW5sZXNzIG9ic2VydmVy LnJlc3BvbmRfdG8/IDp1cGRhdGUKLSAgICAgIHJhaXNlIE5vTWV0aG9kRXJyb3IsICJvYnNlcnZl ciBuZWVkcyB0byByZXNwb25kIHRvIGB1cGRhdGUnIiAKKyAgZGVmIGFkZF9vYnNlcnZlcihvYnNl cnZlciwgZnVuYz06dXBk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