File: except.rb

package info (click to toggle)
ruby-backports 3.25.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,912 kB
  • sloc: ruby: 11,759; makefile: 6
file content (10 lines) | stat: -rw-r--r-- 254 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
class << ENV
  def except(*keys)
    if keys.size > 4 && size > 4 # index if O(m*n) is big
      h = {}
      keys.each { |key| h[key] = true }
      keys = h
    end
    reject { |key, _value| keys.include? key}
  end
end unless ENV.respond_to? :except