We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
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.
> "... 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
two
three
end
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).
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.
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?