Sha256: b3e5a0e0102da8209a64c17da90748531c15ddeb10fde70cbd2e4bdf9d5b331b
Contents?: true
Size: 469 Bytes
Versions: 51
Compression:
Stored size: 469 Bytes
Contents
unless {}.respond_to? :slice class Hash def slice(*keys) allowed = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys) hash = {} allowed.each { |k| hash[k] = self[k] if has_key?(k) } hash end def slice!(*keys) keys = keys.map! { |key| convert_key(key) } if respond_to?(:convert_key) omit = slice(*self.keys - keys) hash = slice(*keys) replace(hash) omit end end end
Version data entries
51 entries across 41 versions & 4 rubygems