I have a variable that prints like this:
{:type1=>:poor, :type2=>:avg, :type3=>:best}
I want to iterate through this hash and print out a final value based on following rules
- if value for any of the types is
:bestthen final value isbest - if value for any of the types is
:avgand there are nobestthen final value isavg - otherwise final value is
poor
basically the strongest ones wins.
I've tries the following
def final_value(values)
val = "poor"
values.each do |key, val|
end
val
end
:pooretc, but you wrote as if there are variable/methodspooretc. Then, you are even mentioning strings"poor"etc.