R6 object extending R6::R6Class() to include interfaces.
Usage
R6.class(
classname = NULL,
public = list(),
private = NULL,
active = NULL,
inherit = NULL,
interfaces = list(),
lock_objects = TRUE,
class = TRUE,
portable = TRUE,
lock_class = FALSE,
cloneable = TRUE,
parent_env = parent.frame()
)Arguments
- classname
Name of the class. The class name is useful primarily for S3 method dispatch.
- public
A list of public members, which can be functions (methods) and non-functions (fields).
- private
An optional list of private members, which can be functions and non-functions.
- active
An optional list of active binding functions.
- inherit
A R6ClassGenerator object to inherit from; in other words, a superclass. This is captured as an unevaluated expression which is evaluated in
parent_enveach time an object is instantiated.- interfaces
An optional list of interfaces implemented for the derived class.
- lock_objects
Should the environments of the generated objects be locked? If locked, new members can't be added to the objects.
- class
Should a class attribute be added to the object? Default is
TRUE. IfFALSE, the objects will simply look like environments, which is what they are.- portable
If
TRUE(the default), this class will work with inheritance across different packages. Note that when this is enabled, fields and members must be accessed withself$xorprivate$x; they can't be accessed with justx.- lock_class
If
TRUE, it won't be possible to add more members to the generator object with$set. IfFALSE(the default), then it will be possible to add more members with$set. The methods$is_locked,$lock, and$unlockcan be used to query and change the locked state of the class.- cloneable
If
TRUE(the default), the generated objects will have method named$clone, which makes a copy of the object.- parent_env
An environment to use as the parent of newly-created objects.