Skip to content

Commit

Permalink
Rmdir
Browse files Browse the repository at this point in the history
  • Loading branch information
keller-mark committed May 7, 2024
1 parent ad6e3d0 commit b22e487
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion R/stores.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Store <- R6::R6Class("Store",
# TODO
},
#' @keywords internal
rmdir_from_keys = function() {
rmdir_from_keys = function(path) {
# TODO
}
),
Expand Down Expand Up @@ -297,6 +297,17 @@ MemoryStore <- R6::R6Class("MemoryStore",
stop("KeyError:", key)
}
return(sort(names(item)))
},
rmdir = function(item) {
parent_and_key <- self$get_parent(item)
parent <- parent_and_key$parent
key <- parent_and_key$key

if(key %in% names(parent)) {
parent[[key]] <- NULL
} else {
stop("KeyError:", item)
}
}
)
)
Expand Down

0 comments on commit b22e487

Please sign in to comment.