From: Thomas Sawyer Date: 2009-02-04T11:37:24+09:00 Subject: [ruby-core:21822] [Feature #1102] Prepend Module Feature #1102: Prepend Module http://redmine.ruby-lang.org/issues/show/1102 Author: Thomas Sawyer Status: Open, Priority: Normal Category: core, Target version: 1.9.x Currently when a module is included into a classes, it is appended to the class hierarchy (ie. the method lookup order). This of course makes sense, but there are times when it would be useful to *prepend* the module. For example: class C def x; "x"; end end module M def x; '[' + super + ']'; end end class C prepend M end C.new.x #=> "[x]" One big advantage of this is being able to override methods in a safer way, rather than using alias or tricks like alias_method_chain. ---------------------------------------- http://redmine.ruby-lang.org