Reputation: 6079
I have a hash table with multiple values being passed to a function I dont know the names of the keys but i know that the values of the keys must be equal to characters A S or X. How can i easily check that all values in the hash table are equal to those characters?
Upvotes: 0
Views: 92
Reputation: 15010
NullUserException is good, you could also
match_values = %w(A S X)
hash.values.all? { |value| match_values.include?(value) }
Upvotes: 2