Given the following hash
hash = {a: 5, b: 10}
I want to check if all values are Integers and < 10.
hash.all?{|key,value| value.is_a? Integer && value < 10} ## TypeError: class or module required from (pry):3:in `is_a?'
hash.all?{|key,value| value.is_a? Integer and value < 10} ## false
Why does the first example with the &&
operator not work inside the block? Is this a precedence issue?