Sha256: 844369dac9a980dc7ad61ad870fa5e6479236deb5277840a78e68b54c0eb7f16
Contents?: true
Size: 762 Bytes
Versions: 26
Compression:
Stored size: 762 Bytes
Contents
require 'set' module ActiveSupport #:nodoc: module CoreExtensions #:nodoc: module Hash #:nodoc: # 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_attributes(params[:person].except(:admin)) module Except # Returns a new hash without the given keys. def except(*keys) rejected = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys) reject { |key,| rejected.include?(key) } end # Replaces the hash without only the given keys. def except!(*keys) replace(except(*keys)) end end end end end
Version data entries
26 entries across 26 versions & 6 rubygems