Learn R Programming

vcr (version 1.6.0)

Hooks: Hooks class

Description

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

Arguments

Public fields

hooks

intenal use

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.

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