# Ensure that a Sinatra hash always has a valid value

I'm trying to ensure that a Sinatra hash always has a valid value.

Is there a more-concise way to write this?

params[:v] = if [:icons,:list].include? (params[:v] ||= :list).downcase.to_sym then (params[:v] ||= :list).downcase.to_sym else :list end

• I'm really unsure what your goal is here. Can you clarify? – thesecretmaster Jul 20 '18 at 2:59

v = (params[:v] || :list).downcase.to_sym