Comments for Ruby clarity http://rubyclarity.com/ Refactorings of Ruby/Rails projects Thu, 13 Jul 2017 18:53:00 +0000 hourly 1 https://wordpress.org/?v=5.4.7 Comment on Is it always a good idea to split long methods into smaller ones? An experiment. by ledestin https://rubyclarity.com/2017/07/is-it-always-a-good-idea-to-split-long-methods-into-smaller-ones-an-experiment/#comment-9 Thu, 13 Jul 2017 18:53:00 +0000 https://rubyclarity.com/?p=412#comment-9 I don’t think it’s a problem at all, I never think whether a method is called by anything else. And if you really need to know that, there’s always ag(1).

]]>
Comment on Is it always a good idea to split long methods into smaller ones? An experiment. by ledestin https://rubyclarity.com/2017/07/is-it-always-a-good-idea-to-split-long-methods-into-smaller-ones-an-experiment/#comment-8 Thu, 13 Jul 2017 18:52:00 +0000 https://rubyclarity.com/?p=412#comment-8 TIL you can do it in Ruby. But I’d rather not do it like that. Just making some private methods would be fine, maybe inside a concern.

]]>
Comment on Is it always a good idea to split long methods into smaller ones? An experiment. by MadBomber https://rubyclarity.com/2017/07/is-it-always-a-good-idea-to-split-long-methods-into-smaller-ones-an-experiment/#comment-7 Thu, 13 Jul 2017 16:38:00 +0000 https://rubyclarity.com/?p=412#comment-7 > “… even though they won’t be called by anything else?.”

I’m almost embarrassed to suggest this structure …

def one
def two; puts 2; end
def three; puts 3; end
puts 1
end

]]>
Comment on Is it always a good idea to split long methods into smaller ones? An experiment. by ledestin https://rubyclarity.com/2017/07/is-it-always-a-good-idea-to-split-long-methods-into-smaller-ones-an-experiment/#comment-6 Fri, 07 Jul 2017 23:03:00 +0000 https://rubyclarity.com/?p=412#comment-6 Yes, but in this post I limited myself just to extracting methods. I wanted to experience and show what it’d be like to do just that.

]]>
Comment on Is it always a good idea to split long methods into smaller ones? An experiment. by Rodrigo Rosenfeld Rosas https://rubyclarity.com/2017/07/is-it-always-a-good-idea-to-split-long-methods-into-smaller-ones-an-experiment/#comment-5 Fri, 07 Jul 2017 16:22:00 +0000 https://rubyclarity.com/?p=412#comment-5 The first thing I would refactor in this method would be to add an early return when attributes are empty? and get rid of that long “unless” block:

return true if attributes.empty?

]]>
Comment on acts_as_list refactoring part 1 by acts_as_list refactoring part 2 – Ruby clarity https://rubyclarity.com/2016/11/acts_as_list-refactoring-part-1/#comment-4 Fri, 27 Jan 2017 03:58:10 +0000 https://rubyclarity.com/?p=184#comment-4 […] now extract methods from .call method and not be afraid to pollute the namespace (as opposed to a single module for all .acts_as_list […]

]]>
Comment on acts_as_list refactoring part 1 by ledestin https://rubyclarity.com/2016/11/acts_as_list-refactoring-part-1/#comment-3 Wed, 21 Dec 2016 09:19:00 +0000 https://rubyclarity.com/?p=184#comment-3 Thanks! I send PRs when they stand a chance to be accepted. The first that was accepted is the PR for this refactoring: https://github.com/swanandp/acts_as_list/pull/229

I know one of the maintainers, so it was easier.

]]>
Comment on acts_as_list refactoring part 1 by Lee Smith https://rubyclarity.com/2016/11/acts_as_list-refactoring-part-1/#comment-2 Tue, 20 Dec 2016 21:25:00 +0000 https://rubyclarity.com/?p=184#comment-2 Great work! Do you ever send in pull requests to these projects?

]]>