Hooks: Hooks class

HooksR Documentation

Hooks class

Description

Helps define new hooks, hold hooks, and accessors to get and use hooks.

Details

Private Methods

make_hook(x, plac, fun)

Make a hook. - x (character) Hook name - plac Placement, one of "start" or "end" - fun a function/callback

Public fields

hooks

intenal use

Methods

Public methods


Method invoke_hook()

invoke a hook

Usage
Hooks$invoke_hook(hook_type, args)
Arguments
hook_type

(character) Hook name

args

(named list) Args passed when invoking a hook

Returns

executes hook


Method clear_hooks()

clear all hooks

Usage
Hooks$clear_hooks()
Returns

no return


Method define_hook()

define a hook

Usage
Hooks$define_hook(hook_type, fun, prepend = FALSE)
Arguments
hook_type

(character) Hook name

fun

A function

prepend

(logical) Whether to prepend or add to the end of the string. Default: FALSE

Returns

no return; defines hook internally


Method clone()

The objects of this class are cloneable with this method.

Usage
Hooks$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


ropenscilabs/vcr documentation built on Feb. 5, 2024, 5:58 p.m.