Skip to content

Commit

Permalink
Only show inherited methods if they exist
Browse files Browse the repository at this point in the history
Fixes #1371
  • Loading branch information
hadley committed Jul 10, 2022
1 parent f5d8c0a commit 764c1d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 3 additions & 1 deletion R/rd-r6.R
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,11 @@ r6_inherited_method_list <- function(block, r6data) {
self <- r6data$self
super_meth <- super_meth[! super_meth$name %in% self$name, ]
super_meth <- super_meth[! duplicated(super_meth$name), ]
if (nrow(super_meth) == 0) {
return()
}

super_meth <- super_meth[rev(seq_len(nrow(super_meth))), ]

details <- paste0(
"<details",
if (nrow(super_meth) <= 5) " open",
Expand Down
6 changes: 0 additions & 6 deletions tests/testthat/_snaps/rd-r6.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@
\item \href{#method-C2-meth1}{\code{C2$meth1()}}
}
}
\if{html}{\out{
<details open><summary>Inherited methods</summary>
<ul>
</ul>
</details>
}}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-C2-meth1"></a>}}
\if{latex}{\out{\hypertarget{method-C2-meth1}{}}}
Expand Down

0 comments on commit 764c1d5

Please sign in to comment.