Ruby: Using .all? when the variable can be an empty array
Context
You have an array of hashes and want to check if all elements are satisfying a condition.
TIL
You might want to do this in Ruby:
objects.all? { _1[:amount] > 10 }
In this case, you should remember according to with the documentation .all? mi...
allaboutcoding.ghinda.com1 min read