From: "robertgleeson (Robert Gleeson)" Date: 2013-09-28T04:20:48+09:00 Subject: [ruby-core:57452] [ruby-trunk - Feature #8839] Class and module should return the class or module that was opened Issue #8839 has been updated by robertgleeson (Robert Gleeson). I agree that returning the class or module makes sense (to me). I'd also like to see "def foo" return a (Unbound)Method instead of a Symbol. it seems like that'd also make more sense (not to derail this conversation). A (Unbound)Method is much more useful. I saw headius mention you can say: i nstance_method def foo end # => UnboundMethod. ...but seems like a nice default. +1 to the proposal. ---------------------------------------- Feature #8839: Class and module should return the class or module that was opened https://bugs.ruby-lang.org/issues/8839#change-42058 Author: headius (Charles Nutter) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: Target version: next minor With the change for https://bugs.ruby-lang.org/issues/3753, "def" forms now return the symbolic name of the method defined. Because class and module bodies just return the last expression in their bodies, this means they will now usually end up returning a symbol for the last method defined. This does not seem useful or correct. I think class and module should return a reference to the class or module just opened. This would make the return value useful and consistent. -- http://bugs.ruby-lang.org/