Sha256: 18a030b8722ba4de86ab02c9abb426aa6723a0ce45ff5da8b5a67e70e53d3ee1
Contents?: true
Size: 835 Bytes
Versions: 8
Compression:
Stored size: 835 Bytes
Contents
module NightcrawlerSwift module Ext module Hash unless {}.respond_to?(:symbolize_keys) def symbolize_keys {}.tap do |result| keys.each {|k| result[k.to_sym] = self[k]} end end def symbolize_keys! self.tap do keys.each {|k| self[k.to_sym] = delete(k)} end end end unless {}.respond_to?(:compact) def compact {}.tap do |result| keys.each {|k| result[k] = self[k] unless self[k].nil?} end end def compact! self.tap do keys.each do |k| value = delete(k) self[k] = value unless value.nil? end end end end end end end Hash.send :include, NightcrawlerSwift::Ext::Hash
Version data entries
8 entries across 8 versions & 1 rubygems