make_methods {r6methods}R Documentation

Make methods

Description

Make methods

Usage

make_methods(
  r6,
  field = c("all", "public", "private", names(r6$public_fields),
    names(r6$private_fields)),
  method = c("both", "get", "set"),
  add_roxygen = TRUE
)

Arguments

r6

R6 class for which to create methods

field

Character, fields for which to create method. May be "all", "public", "private" or name of class field. Multiple values allowed.

method

Character, methods to create. One of "both", "get", "set"

add_roxygen

Logical, whether to add roxygen description of method

Value

Character containing generated methods to put into class definition

Examples

Example <- R6::R6Class("Example", list(public_field = NULL), list(private_field = NULL))
make_methods(Example)
make_methods(Example, "private", "get")
make_methods(Example, "private_field", c("get", "set"))
make_methods(Example, "public_field", c("both"))

[Package r6methods version 0.1.0 Index]