Project

General

Profile

ActionsLike0

Feature #1102

closed

Prepend Module

Added by trans (Thomas Sawyer) about 16 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
[ruby-core:21822]

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


Related issues 1 (1 open0 closed)

Related to Ruby - Feature #6452: Allow extend to override class methodsAssignedmatz (Yukihiro Matsumoto)Actions
#2

Updated by marcandre (Marc-Andre Lafortune) over 15 years ago

  • Assignee set to matz (Yukihiro Matsumoto)
#5

Updated by mame (Yusuke Endoh) about 15 years ago

  • Target version changed from 2.0.0 to 3.0
#6

Updated by mame (Yusuke Endoh) about 15 years ago

  • Status changed from Open to Feedback
#7

Updated by naruse (Yui NARUSE) over 13 years ago

  • Project changed from Ruby to 14
  • Category deleted (core)
  • Target version deleted (3.0)
#8

Updated by naruse (Yui NARUSE) over 13 years ago

  • Project changed from 14 to Ruby

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)
#12

Updated by nobu (Nobuyoshi Nakada) almost 13 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 0 to 100
ActionsLike0

Also available in: Atom PDF