R/utils.R

Defines functions pool_metadata

pool_metadata <- function(x,
                          check_valid = TRUE,
                          error_call = caller_env(),
                          error_arg = caller_arg(x)) {
  meta <- attr(x, "pool_metadata", exact = TRUE)

  if (is.null(meta)) {
    abort(
      paste0("`", error_arg, "` is not an pooled object."),
      call = error_call
    )
  }
  if (check_valid && !meta$valid) {
    abort(
      paste0("`", error_arg, "` is no longer valid."),
      call = error_call
    )
  }

  meta
}

Try the pool package in your browser

Any scripts or data that you put into this service are public.

pool documentation built on March 7, 2023, 6:49 p.m.