Sha256: ea2ad30c33951c49ea1a698b485ebb5aa4f300dcbf587fb8cf889bc2fabfb4fb
Contents?: true
Size: 369 Bytes
Versions: 82
Compression:
Stored size: 369 Bytes
Contents
class Hash def limit_to_keys(limit_keys) dup.limit_to_keys!(limit_keys) end def limit_to_keys!(limit_keys) keys.each { |key| delete(key) unless limit_keys.include? key } self end def soft_delete(key) cloned_hash = deep_clone cloned_hash.delete(key) cloned_hash end def deep_clone Marshal::load(Marshal.dump(self)) end end
Version data entries
82 entries across 82 versions & 1 rubygems