Ruby 3.1 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > ENVオブジェクト > each_key
each_key -> Enumerator
[permalink][rdoc]each_key {|key| ... } -> self
key を引数としてブロックを評価します。
ENV['FOO'] = 'bar'
ENV.each_key do |key|
p "key #{key} detected" if key == 'FOO'
end
# "key FOO detected"