R/formatted.R

Defines functions pak_preformat print.pak_preformatted format.pak_preformatted

#' @export

format.pak_preformatted <- function(x, ...) {
  attr(x, "pak_preformatted")
}

#' @export

print.pak_preformatted <- function(x, ...) {
  cat(format(x, ...), sep = "\n")
}

pak_preformat <- function(x, ...) {
  attr(x, "pak_preformatted") <- format(x, ...)
  class(x) <- c("pak_preformatted", class(x))
  x
}
r-lib/pak documentation built on Nov. 9, 2024, 2:34 a.m.