Sha256: a1258cb8b4c14890540684de78f517bb925fb6e595bc5004409ad301d2e2a01a
Contents?: true
Size: 597 Bytes
Versions: 35
Compression:
Stored size: 597 Bytes
Contents
module Cms module Extensions module Hash #Returns a copy of the hash without the keys passed as arguments def except(*args) reject {|k,v| args.include?(k) } end # This takes a list of keys and returns a new hash # containing the key/values that match the keys passed in. # This will also remove the keys from this hash def extract!(*keys) keys.inject({}) do |hash, key| hash[key] = delete(key) if has_key?(key) hash end end end end end Hash.send(:include, Cms::Extensions::Hash)
Version data entries
35 entries across 35 versions & 11 rubygems