copy_attr {bandicoot}R Documentation

Copy attributes and methods from classes or instances

Description

This function copy attributes and methods from classes or instances to class or instance.

Usage

copy_attr(
  env,
  ...,
  avoid = c("..method_env..", "..init_call.."),
  class_name = env$..type..
)

Arguments

env

Environment. The destination environment.

...

Environments. Source environments.

avoid

Character. Names that don't want to be copied.

class_name

Character. Name of the class the method is defined. This is important for super() to resolve the correct parent class.

Details

Multiple classes or instances can be provided in ..., where the right one will override the left one if they have the same attribute or method name. Attributes or methods that don't want to be copied can be specified in avoid.

Value

Return the object itself.

Examples


test <- new.env()
names(BASE)
copy_attr(test, BASE, avoid = c("..method_env..", "..init_call..", "..dir.."))
names(test)


[Package bandicoot version 1.0.0 Index]