Skip to content

Instantly share code, notes, and snippets.

@euccas
Last active June 8, 2020 02:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save euccas/6724ff6a18858cb01080a222c2157249 to your computer and use it in GitHub Desktop.
Save euccas/6724ff6a18858cb01080a222c2157249 to your computer and use it in GitHub Desktop.
remove empty hash element
def remove_empty_hash_element(h)
if h and h.length>0
h.each do |k,v|
h.delete(k) if v.respond_to?('empty?') and v.empty?
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment