Learn R Programming

eventr (version 1.0.0)

get_fun: Get Function

Description

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

Usage

get_fun(obj)

Arguments

obj

An object of type handler, handler_list or dispatcher.

Value

Returns a function

Examples

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab