Or, as a variation on the above solutions, use an array of the two
keys as the hash key:

@h = {["x","aa"] => [2,3], ["x", "bb"] => ["boo"],
     ["y","aa"] => [5], ["y", "cc"] => ["see", "sea"]}

def isValue?(main,embedded,value)
  return false if @h[[main, embedded]].nil?
  @h[[main, embedded]].include?(value)
end
   
p isValue?("y", "cc", "see")  # true
p isValue?("a", "b", "c")     # false
             
Wayne Vucenic
No Bugs Software
"Ruby and C++ Contract Programming in Silicon Valley"