Skip to content

Commit fd5a5b1

Browse files
committed
add as.list() method
1 parent 84dcb5b commit fd5a5b1

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,7 @@ import(gtable)
770770
import(rlang)
771771
import(scales)
772772
import(vctrs)
773+
importFrom(S7,convert)
773774
importFrom(grid,arrow)
774775
importFrom(grid,unit)
775776
importFrom(lifecycle,deprecated)

R/plot.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,4 +275,11 @@ S7::method(plot, class_ggplot) <- `print.ggplot2::ggplot`
275275
#' @export
276276
`[[<-.ggplot2::gg` <- `$<-.ggplot2::gg`
277277

278+
#' @importFrom S7 convert
279+
S7::method(convert, list(from = class_ggplot, to = S7::class_list)) <-
280+
function(from, to) {
281+
S7::props(from)
282+
}
278283

284+
S7::method(as.list, class_ggplot) <- function(x, ...) convert(x, S7::class_list)
285+
rm(`as.list`)

0 commit comments

Comments
 (0)