| 1 |
pillar_capital <- function(x, title = NULL) { |
| 2 |
title <- new_pillar_title(title) |
| 3 |
type <- new_pillar_type(x) |
| 4 |
new_pillar_capital(title, type) |
| 5 |
} |
| 6 |
|
| 7 |
new_pillar_capital <- function(title, type) { |
| 8 |
ret <- structure( |
| 9 |
list( |
| 10 |
title = title, |
| 11 |
type = type |
| 12 |
), |
| 13 |
class = "pillar_capital" |
| 14 |
) |
| 15 |
|
| 16 |
ret <- set_width(ret, max(get_width(title), get_width(type))) |
| 17 |
ret <- set_min_width(ret, max(get_min_width(title), get_min_width(type))) |
| 18 |
ret |
| 19 |
} |
| 20 |
|
| 21 |
#' @export |
| 22 |
format.pillar_capital <- function(x, width, ...) { |
| 23 |
c( |
| 24 |
format(x$title, width = width, ...), |
| 25 |
format(x$type, width = width, ...) |
| 26 |
) |
| 27 |
} |