You can make a gem of course if you like to.
But please don't discuss it to be a core feature.
On Fri, Jan 13, 2017 at 6:20 PM, Daniel Ferreira <subtileos@gmail.com> > wrote:
On Fri, 13 Jan 2017 at 15:11, Robert Klemme <shortcutter@googlemail.com> > wrote:
On Fri, Jan 13, 2017 at 1:05 PM, Daniel Ferreira <subtileos@gmail.com> > wrote:
> Because I don't like it.
>
> I like to have my methods organised in alphabetical order in order to
have
> common logic gathered near by.
> Also I like to look at a method and understand what is its visibility.
> All of this is very important to save time when doing code reviews or
> inspecting current code to develop new features.
>
> My rules are very strict on this regard.
irb(main):003:0> class C; def foo;end; def bar_; end;
instance_methods(false).each {|m| /_$/ =~ m and private m}; end
=> [:foo, :bar_]
irb(main):004:0> C.private_instance_methods(false)
=> [:bar_]
You can use that
class Module
def privatize
instance_methods(false).each {|m| /_$/ =~ m and private m}
end
end
class Foo
def a_; end
def b; end
def c_; end
privatize
end
p Foo.private_instance_methods(false)
robert
--
[guy, jim, charlie].each {|him| remember.him do |as, often| as.you_can
- without end}
http://blog.rubybestpractices.com/
Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Thanks Robert.
That comes inline with my thoughts.
Is it worthy making a gem of it and taking the discussion to ruby core?
Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Why not take it to ruby core?
It would be much better to handle it in the parser.