From: "luislavena (Luis Lavena)" Date: 2012-09-18T23:48:00+09:00 Subject: [ruby-core:47573] [ruby-trunk - Feature #7019] allow `private` and `protected` keywords to take blocks Issue #7019 has been updated by luislavena (Luis Lavena). Category set to core Target version set to 2.0.0 =begin headius (Charles Nutter) wrote: > +1 for "private def foo". I have never seen a good justification for why visibility is better as a value on the current frame, nor for why it's better to set a method's visibility after declaration rather than along with the declaration. > So two changes: * (({def})) will require to return the method defined instead of (({nil})) * (({private})) will require to accept a (({Method})) and not just a (({Symbol})) I believe these two changes where already requested (can't find the bug reports yet). This approach helps also to describe methods beyond documentation markers, making it clear when a method is private inline with the method definition and not after the method has been defined. I like this. =end ---------------------------------------- Feature #7019: allow `private` and `protected` keywords to take blocks https://bugs.ruby-lang.org/issues/7019#change-29500 Author: alexeymuranov (Alexey Muranov) Status: Open Priority: Normal Assignee: Category: core Target version: 2.0.0 =begin I like to indent my private methods one level deeper, but this indentation is inconsistent with the syntax: class C def f # end private def g # end end I think it would be nice if the (({private})) keyword could take a block, then i would write: class C def f # end private do def g # end end end =end -- http://bugs.ruby-lang.org/