R/box.R

Defines functions replacements_box

replacements_box <- function(env) {
  unlist(recursive = FALSE, eapply(env, all.names = TRUE,
      function(obj) {
        if (inherits(attr(obj, "spec"), "box$mod_spec")) {
          obj_impl <- attr(obj, "namespace")
          compact(
            c(
              lapply(ls(obj_impl),
                function(f_name) {
                  f <- get(f_name, obj_impl)
                  if (inherits(f, "function")) {
                    replacement(f_name, env = obj, target_value = f)
                  }
                }
              ),
              unlist(recursive = FALSE,
                lapply(ls(obj_impl),
                  function(f_name) {
                    f <- get(f_name, obj_impl)
                    if (inherits(f, "R6ClassGenerator")) {
                      traverse_R6(f, obj)
                    }
                  }
                )
              )
            )
          )
        }
      }
    )
  )
}

Try the covr package in your browser

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

covr documentation built on Nov. 10, 2025, 1:06 a.m.