Skip to content

Commit 6f921ef

Browse files
committed
Add helper to get attributes from ggproto method
1 parent d18d316 commit 6f921ef

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

R/ggproto.r

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,3 +351,7 @@ format.ggproto_method <- function(x, ...) {
351351

352352
# proto2 TODO: better way of getting formals for self$draw
353353
ggproto_formals <- function(x) formals(environment(x)$f)
354+
355+
ggproto_attr <- function(x, which, default = NULL) {
356+
attr(environment(x)$f, which = which, exact = TRUE) %||% default
357+
}

0 commit comments

Comments
 (0)