Skip to content

Commit

Permalink
Fix broken cache_exists method.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertzk committed Jul 22, 2015
1 parent add919f commit e6ef77b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by roxygen2 (4.1.0): do not edit by hand

S3method(print,director)
export(director)
export(is.director)
export(registry)
Expand Down
11 changes: 8 additions & 3 deletions R/director.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ NULL
#' @format NULL
director_ <- R6::R6Class("director",
private = list(
),
public = list(
.root = NULL, # character
.project_name = NULL, # character
.resource_cache = list(), # list
.registry = NULL, # registry
.dependency_nesting_level = 0, # integer
.parsers = list(), # list
.preprocessors = list(), # list
.cached_resources = list() # character
),
public = list(
.cached_resources = list(), # character
# Members
dependency_stack = NULL, # stack
cache = NULL,
Expand Down Expand Up @@ -129,6 +129,11 @@ director <- structure(
..1
}

#' @export
print.director <- function(x, ...) {
x$show()
}

#' @docType function
#' @name director
#' @export
Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ simple_cache <- function() {
## If instead we said `cache[[key]] <<- value`, `NULL` values would be
## cached incorrectly, since assigning `NULL` remove the key.
set = function(key, value) cache[key] <<- structure(list(value), .Names = key),
exists = function(key) is.element(key, names(key)),
exists = function(key) is.element(key, names(cache)),

This comment has been minimized.

Copy link
@robertzk

robertzk Jul 22, 2015

Author Member

Incredibly severe that this was not caught by tests.

This comment has been minimized.

Copy link
@kirillseva

kirillseva Jul 22, 2015

Member

o-oh

unset = function(key) cache[[key]] <<- NULL
)
}
Expand Down

0 comments on commit e6ef77b

Please sign in to comment.