Sha256: 874963c94169aa6de8b708d51571237057e385d830e90fcaf45410d9836a9f9c
Contents?: true
Size: 698 Bytes
Versions: 4
Compression:
Stored size: 698 Bytes
Contents
module Buff module Extensions::Hash # Borrowd and modified from # {https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/hash/except.rb} module Except # Return a hash that includes everything but the given keys. This is useful for # limiting a set of parameters to everything but a few known toggles: # # @person.update(params[:person].except(:admin)) def except(*keys) dup.except!(*keys) end # Replaces the hash without the given keys. def except!(*keys) keys.each { |key| delete(key) } self end end end end class Hash include Buff::Extensions::Hash::Except end
Version data entries
4 entries across 4 versions & 1 rubygems