Switch foo.has_key(bar) to "bar in foo" (and its negation).