Skip to content

Commit

Permalink
Re-document with latest roxygen2 features (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley authored Jul 16, 2024
1 parent d560ad1 commit 5e9c878
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 188 deletions.
8 changes: 8 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ S3method(as_glue,character)
S3method(as_glue,default)
S3method(as_glue,glue)
S3method(print,glue)
S3method(testthat::compare,glue)
S3method(vctrs::vec_cast,character.glue)
S3method(vctrs::vec_cast,glue.character)
S3method(vctrs::vec_cast,glue.glue)
S3method(vctrs::vec_ptype2,character.glue)
S3method(vctrs::vec_ptype2,glue.character)
S3method(vctrs::vec_ptype2,glue.glue)
S3method(waldo::compare_proxy,glue)
export(as_glue)
export(backtick)
export(double_quote)
Expand Down
154 changes: 0 additions & 154 deletions R/compat-s3-register.R

This file was deleted.

6 changes: 6 additions & 0 deletions R/glue-package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#' @keywords internal
"_PACKAGE"

## usethis namespace: start
## usethis namespace: end
NULL
9 changes: 0 additions & 9 deletions R/glue.R
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,3 @@ as.character.glue <- function(x, ...) {

#' @importFrom methods setOldClass
setOldClass(c("glue", "character"))


#' Deprecated Functions
#'
#' These functions are Deprecated in this release of glue, they will be removed
#' in a future version.
#' @name glue-deprecated
#' @keywords internal
NULL
4 changes: 2 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ delayed_assign <- function(x, value, eval.env = parent.frame(1), assign.env = pa
do.call(delayedAssign, list(x, value, eval.env, assign.env))
}

## @export
#' @exportS3Method testthat::compare
compare.glue <- function(x, y, ...) {
if (identical(class(y), "character")) {
class(x) <- NULL
}
NextMethod("compare")
}

## @export
#' @exportS3Method waldo::compare_proxy
compare_proxy.glue <- function(x, path = "x") {
class(x) <- NULL
NextMethod("compare_proxy")
Expand Down
9 changes: 6 additions & 3 deletions R/vctrs.R
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@

# Registered in .onLoad()

#' @exportS3Method vctrs::vec_ptype2
vec_ptype2.glue.glue <- function(x, y, ...) {
x
}
#' @exportS3Method vctrs::vec_ptype2
vec_ptype2.glue.character <- function(x, y, ...) {
x
}
#' @exportS3Method vctrs::vec_ptype2
vec_ptype2.character.glue <- function(x, y, ...) {
y
}

# Note order of class is the opposite as for ptype2
#' @exportS3Method vctrs::vec_cast
vec_cast.glue.glue <- function(x, to, ...) {
x
}
#' @exportS3Method vctrs::vec_cast
vec_cast.glue.character <- function(x, to, ...) {
as_glue(x)
}
#' @exportS3Method vctrs::vec_cast
vec_cast.character.glue <- function(x, to, ...) {
unclass(x)
}
10 changes: 0 additions & 10 deletions R/zzz.R
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
# nocov start
.onLoad <- function(...) {
s3_register("testthat::compare", "glue")

s3_register("waldo::compare_proxy", "glue")

s3_register("vctrs::vec_ptype2", "glue.glue")
s3_register("vctrs::vec_ptype2", "character.glue")
s3_register("vctrs::vec_ptype2", "glue.character")
s3_register("vctrs::vec_cast", "glue.glue")
s3_register("vctrs::vec_cast", "character.glue")
s3_register("vctrs::vec_cast", "glue.character")

if (isNamespaceLoaded("knitr") &&
"knit_engines" %in% getNamespaceExports("knitr")) {
Expand Down
10 changes: 0 additions & 10 deletions man/glue-deprecated.Rd

This file was deleted.

35 changes: 35 additions & 0 deletions man/glue-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5e9c878

Please sign in to comment.