Sha256: 26f376b922e670aab637aee5dcb0d1837a9d25ab2ca654e05bf0b6a0afba708b
Contents?: true
Size: 548 Bytes
Versions: 2
Compression:
Stored size: 548 Bytes
Contents
# Essential extensions to base object class module RedSnow # Class from MatterCompiler as ascendant class Object # Symbolizes keys of a hash def deep_symbolize_keys return each_with_object({}) { |memo, (k, v)| memo[k.to_sym] = v.deep_symbolize_keys } if self.is_a?(Hash) return each_with_object([]) { |memo, v | memo << v.deep_symbolize_keys } if self.is_a?(Array) self end # Returns true if object is nil or empty, false otherwise def blank? respond_to?(:empty?) ? empty? : !self end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
redsnow-0.3.4 | lib/redsnow/object.rb |
redsnow-0.3.3 | lib/redsnow/object.rb |