| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/ctl_pillar.R |
| 3 |
\name{new_pillar} |
| 4 |
\alias{new_pillar} |
| 5 |
\title{Construct a custom pillar object} |
| 6 |
\usage{ |
| 7 |
new_pillar(components, ..., width = NULL, class = NULL, extra = deprecated()) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{components}{A named list of components constructed with \code{\link[=pillar_component]{pillar_component()}}.} |
| 11 |
|
| 12 |
\item{...}{These dots are for future extensions and must be empty.} |
| 13 |
|
| 14 |
\item{width}{Default width, optional.} |
| 15 |
|
| 16 |
\item{class}{Name of subclass.} |
| 17 |
|
| 18 |
\item{extra}{Deprecated.} |
| 19 |
} |
| 20 |
\description{ |
| 21 |
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} |
| 22 |
|
| 23 |
\code{new_pillar()} is the low-level constructor for pillar objects. |
| 24 |
It supports arbitrary components. |
| 25 |
See \code{\link[=pillar]{pillar()}} for the high-level constructor with default components. |
| 26 |
} |
| 27 |
\details{ |
| 28 |
Arbitrary components are supported. |
| 29 |
If your tibble subclass needs more or different components in its pillars, |
| 30 |
override or extend \code{\link[=ctl_new_pillar]{ctl_new_pillar()}} and perhaps \code{\link[=ctl_new_pillar_list]{ctl_new_pillar_list()}}. |
| 31 |
} |
| 32 |
\examples{ |
| 33 |
lines <- function(char = "-") { |
| 34 |
stopifnot(nchar(char) == 1) |
| 35 |
structure(char, class = "lines") |
| 36 |
} |
| 37 |
|
| 38 |
format.lines <- function(x, width, ...) { |
| 39 |
paste(rep(x, width), collapse = "") |
| 40 |
} |
| 41 |
|
| 42 |
new_pillar(list( |
| 43 |
title = pillar_component(new_ornament(c("abc", "de"), align = "right")), |
| 44 |
lines = new_pillar_component(list(lines("=")), width = 1) |
| 45 |
)) |
| 46 |
} |