Skip to contents

This function tries to turn an environment into a bandicoot_oop object.

Usage

as_bandicoot_oop(
  env,
  ..class.. = NULL,
  ..type.. = NULL,
  ..instantiated.. = NULL,
  overwrite_container = FALSE,
  register = FALSE,
  in_place = FALSE,
  container_name = "..method_env..",
  self_name = "self"
)

Arguments

env

An environment.

..class..

Character. A series of class names.

..type..

Character. The class name of this object.

..instantiated..

Boolean. Whether this object is an instance.

overwrite_container

Boolean. Whether or not to overwrite the container.

register

Boolean. Whether or not to register functions if there are any.

in_place

Boolean. Whether or not to modify the environment in-place. If not, a new environment will be created.

container_name

Character. Name of the container.

self_name

Character. Name of the self reference.

Value

A Boolean value.

Examples


e <- new.env()
e$a <- function() self

as_bandicoot_oop(e,
                 ..class.. = "test",
                 ..type.. = "test",
                 ..instantiated.. = FALSE,
                 register = TRUE,
                 in_place = TRUE)
#> 
#> ── <unknown object> 

e
#> 
#> ── <unknown object> 
e$a()
#> 
#> ── <unknown object>