Sha256: d52b9687f0551891af1da47c1e48afac7c9b7a5a2cfdc9a9a38b3eb47bb1bb1e
Contents?: true
Size: 532 Bytes
Versions: 5
Compression:
Stored size: 532 Bytes
Contents
class SafeCookies::Util class << self def slice(hash, *allowed_keys) sliced_hash = hash.select { |key, _value| allowed_keys.include? key } # Normalize the result of Hash#select # (Ruby 1.8 returns an Array, Ruby 1.9 returns a Hash) Hash[sliced_hash] end # rejected_keys may be of type String or Regex def except!(hash, *rejected_keys) hash.delete_if do |key, _value| rejected_keys.any? { |rejected| rejected === key } end end end end
Version data entries
5 entries across 5 versions & 1 rubygems