Printing flight statuses I have a serious nesting of ifs in a helper code and I would like to making cleaner. I would like to avoid case if possible as well.

I know there is probably a more object-oriented approach to this but I can't seem to know how.

I'm flooded with stuff like this:

  def print_flight_options_status(invitation)
    if invitation.group.travel_class == 'none'
      not_allowed
    elsif invitation.refused_flight_options?
      not_needed
    elsif invitation.selected_flights?
      waiting_reservation
    elsif invitation.flight_options.empty?
      not_sent_yet
    elsif invitation.requested_more_flight_options?
      rejected
    else
      waiting_guest_input
    end
  end

  def print_event_terms_status(invitation)
    if invitation.event_terms_status.nil?
      "&lt;span class='grey_highlight pj_cat'&gt;Aguardando&lt;/span&gt;"
    elsif invitation.accepted_event_terms?
      "&lt;span class='green_highlight pj_cat'&gt;Aceito&lt;/span&gt;"
    elsif invitation.rejected_event_terms?
      "&lt;span class='red_highlight pj_cat'&gt;Declinado&lt;/span&gt;"
    elsif invitation.cancelled_event_terms?
      "&lt;span class='yellow_highlight pj_cat'&gt;Cancelado&lt;/span&gt;"
    end.html_safe
  end
I prefer this style:

  def print_flight_options_status(invitation)
    return not_allowed         if invitation.group.travel_class == 'none'
    return not_needed          if invitation.refused_flight_options?
    return waiting_reservation if invitation.selected_flights?
    return not_sent_yet        if invitation.flight_options.empty?
    return rejected            if invitation.requested_more_flight_options?

    waiting_guest_input
  end


UPD

About second code-snippet. I think in this case you can use decorators (for example draper) for invitations, so:

def print_event_terms_status(invitation)
  InvitationDecorator.decorate(invitation).status_in_html
end


Where InvitationDecorator:

class InvitationDecorator &lt; Draper::Base
  def status_in_html
    if invitation.event_terms_status.nil?
      "&lt;span class='grey_highlight pj_cat'&gt;Aguardando&lt;/span&gt;"
    ...
  end
end