From: Holden Glova Date: 2001-01-09T16:21:53+09:00 Subject: [ruby-talk:8899] Re: Modules and mixins -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Mon, 08 Jan 2001 15:53, I think Kevin Smith wrote: > Personally, I don't go looking for a reason to > use modules. If/when I find something I want to > do that is difficult, I try to find language > support for making it easier. That's when I would > turn to a module. Just to clarify, I wasn't looking for a reason to use them, merely for a way to recognize when I might want to use them. .... snipped some good points of clarity ... > Let's say you wanted to add a debug logging > method to several unrelated classes. The method > is called log, and it figures out once where to > send the log data, and after that it just sends > it. Rather than inserting the same "def log..." > code into each class, you can mix it in by > creating a module that has the log method > defined, and just including it into each class > that you want to be able to log. Ok, this is an example where I would probably start out with aggregation. Perhaps a pattern to look for would be when many classes are aggregating a common class(s) to provide a(several) common elements of functionality - would you/others agree with this? The light my have just clicked on within my sometimes dark tunnel of vision *wink* > >P.S. Anyone give me a hint on what I should be looking for in order to > > create and use the underscore in a Menu with GTK? > > The full GTK+ seems to have a "factory" that > allows you specify an underscore. It does not > appear that Ruby/GTK wraps that. > > If you can query a menu item to get its > underlying label object, you can set up an > underline mask for that label, according to the > online GTK reference I use. I haven't tried it > myself, yet, and I haven't checked to see if > Ruby/GTK supports that. Thanks for your input there Kevin, I thougth I was just missing how to do it and the answer was sitting right in front of my nose :-) > Kevin - -- Signed, Holden Glova -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.4 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE6Wrt1zrxa+Gy/b/4RAtGJAJ4kADlKcU0MLWPpADi7F7jGyGTpxwCfWbH1 UzjuZAICM69+lNWopxHpWjo= =1W8Z -----END PGP SIGNATURE-----