get_fun: Get Function

Description Usage Arguments Value Examples

View source: R/get_fun.R

Description

Get the function in a handler, handler_list or dispatcher objects.

Usage

1
get_fun(obj)

Arguments

obj

An object of type handler, handler_list or dispatcher.

Value

Returns a function

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
set_birth_date <- function(obj, event){
  obj$birthDate <- event$body$birthDate
  return(obj)
}

set_death_date <- function(obj, event){
  obj$deathDate <- event$body$deathDate
  return(obj)
}

birth_handler <- handler(type = 'BIRTH', FUN = set_birth_date)
get_fun(birth_handler)

death_handler <- handler(type = 'DEATH', FUN = set_death_date)
get_fun(death_handler)

handlers <- handlers_list(birth_handler, death_handler)
get_fun(handlers)

eventr documentation built on July 8, 2020, 7:32 p.m.