Module: InJson::HashExt::InstanceMethods

Defined in:
lib/in_json/ext/hash.rb

Instance Method Summary collapse

Instance Method Details

#recursively_reject(default = nil, &blk) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/in_json/ext/hash.rb', line 8

def recursively_reject(default = nil, &blk)
  inject({}) do |result, k_v|
    key, value = k_v
    result[key] = value.is_a?(Hash) ? value.recursively_reject(&blk) : (value || default)
    result
  end.reject(&blk)
end