Is there a more succinct way to write this Ruby function? Just for fun, I want to try to write this Ruby function more succinctly. I imagine it can be done, I'm just not knowledgeable enough with Ruby yet to know how. Any suggestions?

  def tags
    return ['Cancelled'] if cancelled?
    tags = []
    tags &lt;&lt; 'Filled' if filled?
    tags &lt;&lt; 'In Progress' if in_progress?
    tags
  end
Functional approach:

def tags
  if cancelled?
    ["Cancelled"]
  else
    [("Filled" if filled?), ("In Progress" if in_progress?)].compact
  end
end


Ideas behind the snippet:


Don't perform imperative side-effects on arrays (unless performance is a problem, not the case here).
Use the pattern: array of "nilable" expressions + compact to build arrays with conditional elements.
Minimize the use of inline conditional statements, they make a function harder to understand. They are ok as guards (early exit of functions), but not here. Note that I do use inline ifs, but they are expressions, not statements; more orthodox -but also more verbose- would be (filled? ? "Filled" : nil).