Sha256: f90e7d3e996da9a3d352eba03a5c5c1ff4da1c91c3a98517b18f52f9064fca36

Contents?: true

Size: 383 Bytes

Versions: 1

Compression:

Stored size: 383 Bytes

Contents

module HashRecursiveBlank
  def rblank
    r = {}

    each_pair do |key, val|
      r[key] = val.rblank if val.is_a?(Hash)
    end

    r.keep_if { |key, val| val.is_a?(Hash) }
  end

  def rblank!
    each_pair do |key, val|
      self[key] = val.rblank! if val.is_a?(Hash)
    end

    keep_if { |key, val| val.is_a?(Hash) }
  end
end

class Hash
  include HashRecursiveBlank
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tdi-0.1.0 lib/rblank.rb