Skip to content

Commit

Permalink
Provide .dollarNames method (#289)
Browse files Browse the repository at this point in the history
* Provide `.dollarNames` method

In order to not show non-user facing methods in autocomplete

* `devtools::document()` (GitHub Actions)

* Update NEWS.md

Co-authored-by: Davis Vaughan <[email protected]>

---------

Co-authored-by: hadley <[email protected]>
Co-authored-by: Winston Chang <[email protected]>
Co-authored-by: Davis Vaughan <[email protected]>
  • Loading branch information
4 people authored Sep 4, 2024
1 parent 5078678 commit e083fbe
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ Suggests:
Config/Needs/website: tidyverse/tidytemplate, ggplot2, microbenchmark, scales
Config/testthat/edition: 3
Encoding: UTF-8
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

S3method(.DollarNames,R6)
S3method(as.list,R6)
S3method(format,R6)
S3method(format,R6ClassGenerator)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
R6 2.5.1.9000
========

* R6 methods no longer recommends `initialize` or `.__enclos_env__` in autocomplete.

* The deprecated `lock` parameter has been removed.

* `R6Class()` now prints a message when a `finalize` method is public instead of private.
Expand Down
6 changes: 6 additions & 0 deletions R/r6_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -541,3 +541,9 @@ R6Class <- encapsulate(function(classname = NULL, public = list(),

generator
})

#' @export
.DollarNames.R6 <- function(x, pattern) {
names <- NextMethod()
names <- setdiff(names, c(".__enclos_env__", "initialize"))
}

0 comments on commit e083fbe

Please sign in to comment.