ClassRegistry: ClassRegistry

ClassRegistryR Documentation

ClassRegistry

Description

Base schema class with which to define custom schemas

Public fields

registry

(list) list of classes registered

Methods

Public methods


Method print()

Usage
ClassRegistry$print(x)

Method register()

Add a class to the registry of serializer classes

Usage
ClassRegistry$register(class_name, cls)
Arguments
class_name

(character) the class name

cls

(Schema) the class object

Returns

nothing, registers internally


Method get_class()

Usage
ClassRegistry$get_class(class_name)

Method clone()

The objects of this class are cloneable with this method.

Usage
ClassRegistry$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

x <- ClassRegistry$new()
x
x$registry
z <- Schema$new("FooBar",
  name = fields$character(),
  title = fields$character()
)
w <- Schema$new("MySchema",
  name = fields$character(),
  title = fields$character()
)
x
x$registry
x$register("FooBar", z)
x$register("MySchema", w)
x
x$registry

x$get_class("FooBar")
x$get_class("MySchema")

ropensci/staypuft documentation built on Sept. 9, 2022, 4:35 p.m.