Skip to content

Instantly share code, notes, and snippets.

Created October 24, 2015 20:53
Show Gist options
  • Save anonymous/edbe6794a0c63bc3f785 to your computer and use it in GitHub Desktop.
Save anonymous/edbe6794a0c63bc3f785 to your computer and use it in GitHub Desktop.
def rec_delete_if(&block)
self.delete_if do |k, v| # REMEMBER: delete_if DELETES IN PLACE!
if v.is_a? Hash
v.rec_delete_if(&block); false
else
yield k, v # should return bool
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment