Skip to content

Commit

Permalink
Improve usage of non-static methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
plietar committed Feb 27, 2024
1 parent 08d8760 commit 57c8ec3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
11 changes: 7 additions & 4 deletions R/bitset.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@
#' resembles the code roxygen2 generates for R6 methods.
#'
#' @noRd
bitset_method_doc <- function(name, description, ...) {
arguments <- list(...)
bitset_method_doc <- function(name, description, static = FALSE, ...) {
lines <- character()
push <- function(...) lines <<- c(lines, ...)

Check warning on line 13 in R/bitset.R

View check run for this annotation

Codecov / codecov/patch

R/bitset.R#L12-L13

Added lines #L12 - L13 were not covered by tests

arguments <- list(...)
argnames <- paste(names(arguments), collapse=", ")
receiver <- if (static) "Bitset" else "b"

Check warning on line 17 in R/bitset.R

View check run for this annotation

Codecov / codecov/patch

R/bitset.R#L15-L17

Added lines #L15 - L17 were not covered by tests

push("\\if{html}{\\out{<hr>}}")
push(paste0("\\subsection{Method \\code{", name, "()}}{"))
push(description)
push("\\subsection{Usage}{")
argnames <- paste(names(arguments), collapse=", ")
push(paste0("\\preformatted{Bitset$", name, "(", argnames, ")}"))
push(sprintf("\\preformatted{%s$%s(%s)}", receiver, name, argnames))
push("}")
if (length(arguments) > 0) {
push("\\subsection{Arguments}{")
Expand Down Expand Up @@ -53,6 +55,7 @@ Bitset <- list(
#' bitset_method_doc(
#' "new",
#' "create a bitset.",
#' static = TRUE,
#' size = "the size of the bitset.",
#' from = "pointer to an existing IterableBitset to use; if \\code{NULL}
#' make empty bitset, otherwise copy existing bitset."
Expand Down
26 changes: 13 additions & 13 deletions man/Bitset.Rd

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

0 comments on commit 57c8ec3

Please sign in to comment.