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 May 1, 2024, 11:16 a.m.