inject_patch.RdInject a runtime patch into a locked package namespace
inject_patch(pkg, patch_list, lock = TRUE)Invisibly TRUE on success.
# Show baseline behavior with broken function
baseline <- dummy_parent_func("test")
print(baseline)
#> [1] "Parent output -> HOTFIXED! Input: test"
# Inject a patched version of the child function
inject_patch(
pkg = "hotpatchR",
patch_list = list(dummy_child_func = function(x) {
paste("I am the FIXED child! Input:", x)
})
)
# Call the parent function again - it now uses the patched child
patched_result <- dummy_parent_func("test")
print(patched_result)
#> [1] "Parent output -> I am the FIXED child! Input: test"