Sha256: fb48983927db72072c11e05986679765aa57a96dd4d8267c1ebd327659860cb4
Contents?: true
Size: 573 Bytes
Versions: 4
Compression:
Stored size: 573 Bytes
Contents
# frozen_string_literal: true class Hash def skip_nil_values dup.compact.each_with_object({}) do |(k, v), acc| next if v.nil? acc[k] = case v when Hash v.skip_nil_values when Array v.compact else v end end end def stringify_values self.deep_merge(self) do |_, _, v| if v.kind_of?(Hash) v.stringify_values elsif v.kind_of?(Array) v.stringify_values else v.to_s end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
remocon-0.5.1 | lib/remocon/util/hash.rb |
remocon-0.5.0 | lib/remocon/util/hash.rb |
remocon-0.4.4 | lib/remocon/util/hash.rb |
remocon-0.4.3 | lib/remocon/util/hash.rb |