News for hackers. Stuff that matters.
Re:How to make your code imply responsibilities by richkuo on Monday October 21, 2013 @12:39PM (#6586624)
Personally the 'if' conditional statement acts as a visual trigger.

It allows me to quickly recognize that something may or may not show up on the view.

I would prefer something along these lines:

  class ProfilePresenter < ::Presenter
    def with_experience?
      profile.has_experience? && profile.experience_public?
    end
  end

  <% if user_profile.with_experience? %>
    <p><strong>Experience:</strong> <%= user_profile.experience %></p>
  <% end %>

There are no comments on this comment yet.