# File lib/map.rb, line 970 def rm(*args) paths, path = args.partition{|arg| arg.is_a?(Array)} paths.push(path) paths.each do |p| if p.size == 1 delete(*p) next end branch, leaf = p[0..-2], p[-1] collection = get(branch) case collection when Hash key = leaf collection.delete(key) when Array index = leaf collection.delete_at(index) else raise(IndexError, "(#{ collection.inspect }).rm(#{ p.inspect })") end end paths end