From: Leo Date: 2001-05-09T09:10:10+09:00 Subject: [ruby-talk:14882] Re: [Q] Why module methods are NOT included by 'include' statement? matz@zetabits.com (Yukihiro Matsumoto) writes: > Hi, > > In message "[ruby-talk:14825] [Q] Why module methods are NOT included by 'include' statement?" > on 01/05/08, Leonid Razoumov writes: > > |Ruby has a powerful 'include some_module' statement which imports into the > |current namespace constants, class variables and instance methods defined in > |some_module. However, module methods are NOT imported. Why so? > > Because "include" are intended to include the methods in a module into > a class/module. I think "including" class/module methods (singleton > methods) is a separate task. You can "include" them by using either > "extend" or "append_features" (or "included" hook method in 1.7). > > matz. Matz, would you, please, give an example of how to use "extend" to include singleton methods. I thought that "extend" (like "include") deals only with instance methods. Such an example will be useful for Ruby FAQ. Thanks, --Leo-- [ slonika AT yahoo DOT com ]