Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/remocon/util/hash.rb
Instance Method Summary collapse
Instance Method Details
#skip_nil_values ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/remocon/util/hash.rb', line 4 def skip_nil_values dup.compact.each_with_object({}) do |(k, v), acc| next unless v acc[k] = case v when Hash v.skip_nil_values when Array v.compact else v end end end |
#stringify_values ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/remocon/util/hash.rb', line 18 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 |