Skip to content

Instantly share code, notes, and snippets.

Created December 18, 2015 16:52
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 anonymous/5b555b6340e89313e5e2 to your computer and use it in GitHub Desktop.
Save anonymous/5b555b6340e89313e5e2 to your computer and use it in GitHub Desktop.
@heartjar = {"lvl1"=>{}, "lvl2"=>{}, "lvl3"=>{}}
def prune(jarnum1, key)
if @heartjar["lvl#{jarnum1}"][key].empty? && jarnum1 < 4
@heartjar["lvl#{jarnum1}"].delete(key)
else
jarnum2 = jarnum1 + 1
for @heartjar["lvl#{jarnum1}"][key].each do |akey|
@heartjar["lvl#{jarnum1}"][key].delete(akey)
prune(jarnum2, akey)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment