-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Richard Cotton
committed
Sep 18, 2016
1 parent
9ca3108
commit 61d076d
Showing
3 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#' Is an object an R6 Class Generator or Object? | ||
#' | ||
#' Checks for R6 class generators and R6 objects. | ||
#' @param x Any variable. | ||
#' @return A logical value. | ||
#' \code{is.r6} returns \code{TRUE} when the input is an R6 class generator or | ||
#' an R6 object, and \code{FALSE} otherwise. | ||
#' \code{is.r6gen} returns \code{TRUE} when the input is an R6 class generator | ||
#' and \code{FALSE} otherwise. | ||
#' \code{is.r6obj} returns \code{TRUE} when the input is an R6 object and | ||
#' \code{FALSE} otherwise. | ||
#' @examples | ||
#' class_generator <- R6::R6Class() | ||
#' object <- class_generator$new() | ||
#' is.r6(class_generator) | ||
#' is.r6gen(class_generator) | ||
#' is.r6obj(class_generator) | ||
#' is.r6(object) | ||
#' is.r6gen(object) | ||
#' is.r6obj(object) | ||
#' @export | ||
is.r6 <- function(x) | ||
{ | ||
is.r6obj(x) || is.r6gen(x) | ||
} | ||
|
||
#' @rdname is.r6 | ||
#' @export | ||
is.r6obj <- function(x) | ||
{ | ||
inherits(x, "R6") | ||
} | ||
|
||
#' @rdname is.r6 | ||
#' @export | ||
is.r6gen <- function(x) | ||
{ | ||
inherits(x, "R6ClassGenerator") | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.