Skip to content

Commit 3866856

Browse files
committed
pillar is now in Suggests, closes #9
1 parent 7ce8882 commit 3866856

File tree

3 files changed

+40
-10
lines changed

3 files changed

+40
-10
lines changed

DESCRIPTION

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ Description: R's raw vector is useful for storing a single binary object.
1010
What if you want to put a vector of them in a data frame? The 'blob'
1111
package provides the blob object, a list of raw vectors, suitable for
1212
use as a column in data frame.
13-
Imports:
13+
License: GPL-3
14+
URL: https://github.com/tidyverse/blob
15+
BugReports: https://github.com/tidyverse/blob/issues
16+
Imports:
1417
methods,
15-
pillar,
1618
prettyunits
17-
License: GPL-3
19+
Suggests:
20+
covr,
21+
pillar (>= 1.2.1),
22+
testthat
1823
Encoding: UTF-8
1924
LazyData: true
20-
URL: https://github.com/hadley/blob
21-
BugReports: https://github.com/hadley/blob/issues
22-
Suggests:
23-
testthat,
24-
covr
2525
Roxygen: list(markdown = TRUE, roclets = c("collate", "namespace", "rd", "pkgapi::api_roclet"))
2626
RoxygenNote: 6.0.1

R/format.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ blob_size <- function(x, digits = 3, trim = TRUE, ...) {
3636
prettyunits::pretty_bytes(x)
3737
}
3838

39-
#' @importFrom pillar pillar_shaft
40-
#' @export
39+
# Dynamically exported, see zzz.R
4140
pillar_shaft.blob <- function(x, ...) {
4241
out <- ifelse(
4342
is.na(x),

R/zzz.R

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# nocov start
2+
.onLoad <- function(...) {
3+
register_s3_method("pillar", "pillar_shaft", "blob")
4+
5+
invisible()
6+
}
7+
8+
register_s3_method <- function(pkg, generic, class, fun = NULL) {
9+
stopifnot(is.character(pkg), length(pkg) == 1)
10+
stopifnot(is.character(generic), length(generic) == 1)
11+
stopifnot(is.character(class), length(class) == 1)
12+
13+
if (is.null(fun)) {
14+
fun <- get(paste0(generic, ".", class), envir = parent.frame())
15+
} else {
16+
stopifnot(is.function(fun))
17+
}
18+
19+
if (pkg %in% loadedNamespaces()) {
20+
registerS3method(generic, class, fun, envir = asNamespace(pkg))
21+
}
22+
23+
# Always register hook in case package is later unloaded & reloaded
24+
setHook(
25+
packageEvent(pkg, "onLoad"),
26+
function(...) {
27+
registerS3method(generic, class, fun, envir = asNamespace(pkg))
28+
}
29+
)
30+
}
31+
# nocov end

0 commit comments

Comments
 (0)