Given:
shipping_costs = {
key1: 45,
key2: 99,
key3: nil,
key4: 24
}
What’s the cleanest way to get the max of those keys assuming nil = 0?
If I run a straight shipping_costs.values.max in the Rails console I get this:
ArgumentError: comparison of Fixnum with nil failed
Cleanest way to turn those nils into zeros before running max?
I’d go for:
nil.to_iis0.