From: Bob Hutchison Date: 2001-12-28T06:24:12+09:00 Subject: [ruby-talk:29487] Module#included Hi, I have downloaded and compiled Ruby 1.7.2 (27 December 2001) and have confirmed that the method Module#included is implemented. I have a few questions about it. It takes one argument that I know of, the new module that is including this module. Are there other arguments? (I don't think so, guessing from the call to rb_define_private_method in object.c -- the last argument is 1 which is called argc in the method's definition in class.c). When is this called? before or after the method is included? what is the state of the module being defined when this method is called? I think it is called before the module is included. Is there a recommended way to obtain some data from the new module (the one including this module). For example, I'd like to set up a hash that maps a string to the new module, but only if it is defined. The trouble is that I cannot use the included module to define default values (it seems, and this is why I think the method is called before the module is included). I am forced to trap an exception if the string is not defined in the new module -- this works, but... What can you do in the included method? Can you affect how things are included? or is this simply an interesting event? Thanks, Bob