Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

ENV.except

ENV.except(*keys) → a_hash

Returns a hash except the given keys from ENV and their values.

Example
ENV                       #=> {"LANG"=>"en_US.UTF-8", "TERM"=>"xterm-256color", "HOME"=>"/Users/rhc"}
ENV.except("TERM","HOME") #=> {"LANG"=>"en_US.UTF-8"}

Ruby version changes

  1. 3.0
See also .empty? .fetch .each_value .filter also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0