ActionsLike0
Feature #1102
closedPrepend Module
Description
=begin
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.
=end
Updated by marcandre (Marc-Andre Lafortune) over 15 years ago
- Assignee set to matz (Yukihiro Matsumoto)
Updated by naruse (Yui NARUSE) over 13 years ago
- Project changed from Ruby to 14
- Category deleted (
core) - Target version deleted (
3.0)
Updated by ko1 (Koichi Sasada) about 13 years ago
- Assignee changed from matz (Yukihiro Matsumoto) to ko1 (Koichi Sasada)
- Target version set to 2.0.0
Updated by ko1 (Koichi Sasada) almost 13 years ago
- Assignee changed from ko1 (Koichi Sasada) to nobu (Nobuyoshi Nakada)
Updated by nobu (Nobuyoshi Nakada) almost 13 years ago
- Status changed from Feedback to Closed
- % Done changed from 0 to 100
ActionsLike0