From: "marcandre (Marc-Andre Lafortune)" Date: 2013-02-18T12:21:41+09:00 Subject: [ruby-core:52427] [ruby-trunk - Bug #7842] An alias of a "prepend"ed method skips the original method when calling super Issue #7842 has been updated by marcandre (Marc-Andre Lafortune). phluid61 (Matthew Kerwin) wrote: > I'm sorry, but this ticket confuses me. Why does "A" ever get output, if > B#m does not also call super? You're right to be confused, there's a missing `super` in the examples that everyone assumed was there. So here's the corrected version: module P def m; puts "P"; super; end end class A def m; puts "A"; end end class B < A def m; puts "B"; super; end alias m2 m prepend P alias m3 m end B.new.m2 #=> expected: B, A B.new.m3 #=> expected: P, B, A ---------------------------------------- Bug #7842: An alias of a "prepend"ed method skips the original method when calling super https://bugs.ruby-lang.org/issues/7842#change-36484 Author: mame (Yusuke Endoh) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: Target version: next minor ruby -v: ruby 2.0.0dev (2013-02-13 trunk 39225) [x86_64-linux] Hello, module P def m; puts "P"; super; end end class A def m; puts "A"; end end class B < A def m; puts "B"; end prepend P alias m2 m end B.new.m2 #=> expected: P, B, A #=> actual: P, A Is this intentional? It looks weird to me that calling super of P#m (as m2) skips A#m. -- Yusuke Endoh -- http://bugs.ruby-lang.org/