Skip to content

Commit f5374ac

Browse files
FIX @exportS3method -> @exportS3Method (#1590)
Fixes #1585. Fixes #1591.
1 parent 808e39a commit f5374ac

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190

191191
* `@author`s are de-duplicated in merged documentation (@DanChaltiel, #1333).
192192

193-
* `@exportS3method pkg::generic` now works when `pkg::generic` isn't
193+
* `@exportS3Method pkg::generic` now works when `pkg::generic` isn't
194194
imported by your package (#1085).
195195

196196
* `@includeRmd` is now adapted to change in rmarkdown 2.12 regarding math

R/namespace.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ warn_missing_s3_exports <- function(blocks, env) {
396396
funs <- Filter(is.function, objs)
397397
methods <- funs[map_lgl(names(funs), is_s3_method, env = env)]
398398

399-
s3blocks <- blocks[map_lgl(blocks, block_has_tags, c("export", "exportS3method"))]
399+
s3blocks <- blocks[map_lgl(blocks, block_has_tags, c("export", "exportS3Method"))]
400400
s3objects <- map(blocks, function(block) block$object$value)
401401

402402
undocumented <- methods[!methods %in% s3objects]
@@ -405,7 +405,7 @@ warn_missing_s3_exports <- function(blocks, env) {
405405
map2(undocumented, names(undocumented), function(fun, name) {
406406
warn_roxy_function(
407407
fun,
408-
"S3 method {.arg {name}} needs @export or @exportS3method tag"
408+
"S3 method {.arg {name}} needs @export or @exportS3Method tag"
409409
)
410410
})
411411
}

tests/testthat/_snaps/namespace.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# @exportS3method generates fully automatically
1+
# @exportS3Method generates fully automatically
22

33
Code
44
. <- roc_proc_text(namespace_roclet(), block)
55
Message
66
x <text>:2: @exportS3Method must be used with an known S3 method.
77

8-
# @exportS3method can extract class from generic
8+
# @exportS3Method can extract class from generic
99

1010
Code
1111
. <- roc_proc_text(namespace_roclet(), block)
@@ -97,13 +97,13 @@
9797
Code
9898
. <- roc_proc_text(namespace_roclet(), block)
9999
Message
100-
x <text>:5: S3 method `mean.myclass` needs @export or @exportS3method tag.
101-
x <text>:3: S3 method `foo.numeric` needs @export or @exportS3method tag.
100+
x <text>:5: S3 method `mean.myclass` needs @export or @exportS3Method tag.
101+
x <text>:3: S3 method `foo.numeric` needs @export or @exportS3Method tag.
102102

103103
---
104104

105105
Code
106106
. <- roc_proc_text(namespace_roclet(), block)
107107
Message
108-
x <text>:3: S3 method `foo.{` needs @export or @exportS3method tag.
108+
x <text>:3: S3 method `foo.{` needs @export or @exportS3Method tag.
109109

tests/testthat/test-namespace.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ test_that("export handles non-syntactic names", {
8686
expect_equal(out, "S3method(\"foo-bar\",integer)")
8787
})
8888

89-
test_that("@exportS3method generates fully automatically", {
89+
test_that("@exportS3Method generates fully automatically", {
9090
out <- roc_proc_text(namespace_roclet(),"
9191
#' @exportS3Method
9292
mean.foo <- function(x) 'foo'
@@ -100,15 +100,15 @@ test_that("@exportS3method generates fully automatically", {
100100
expect_snapshot(. <- roc_proc_text(namespace_roclet(), block))
101101
})
102102

103-
test_that("@exportS3methd can create literal directive", {
103+
test_that("@exportS3Method can create literal directive", {
104104
out <- roc_proc_text(namespace_roclet(),
105105
"#' @exportS3Method base::mean foo
106106
NULL
107107
")
108108
expect_equal(out, "S3method(base::mean,foo)")
109109
})
110110

111-
test_that("@exportS3method can extract class from generic", {
111+
test_that("@exportS3Method can extract class from generic", {
112112
out <- roc_proc_text(namespace_roclet(), "
113113
#' @exportS3Method pkg::foo
114114
foo.bar <- function(x) 'foo'

vignettes/namespace.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This is a little frustrating at first, but soon becomes second-nature.
2020
## Exports
2121

2222
In order for your users to use a function[^1] in your package, you must **export** it.
23-
In most cases, you can just use the `@export` tag, and roxygen2 will automatically figure out which `NAMESPACE` directive (i.e. `export()`, `exportS3method()`, `exportClasses()`, or `exportMethods()`) you need.
23+
In most cases, you can just use the `@export` tag, and roxygen2 will automatically figure out which `NAMESPACE` directive (i.e. `export()`, `S3method()`, `exportClasses()`, or `exportMethods()`) you need.
2424

2525
[^1]: Including S3 and S4 generics and methods.
2626

0 commit comments

Comments
 (0)