From 9d9f72069f96d478e54465375f290d6f616cead9 Mon Sep 17 00:00:00 2001 From: DivadNojnarg Date: Mon, 2 Sep 2024 13:57:42 +0200 Subject: [PATCH] category default to avoid breaking change --- NEWS.md | 13 ++++--------- R/registry.R | 4 ++-- man/available_blocks.Rd | 4 ++-- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/NEWS.md b/NEWS.md index f16bf93a..d8d525f3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,8 @@ # blockr 0.0.2.9000 -## Breaking changes -- Added new `category` to the registry. Now when a block is registered, you must pass a category parameter (which is used by the add block feature to sort blocks): +## Feature +- Improved __add__ new block. +- Added new `category` to the registry. Now when a block is registered, you may pass a category parameter (which is used by the add block feature to sort blocks): ```r register_block( @@ -13,13 +14,7 @@ register_block( input = "data.frame", output = "data.frame" ) - -# Adding category to avoid -# error: argument "category" is missing, with no default -``` - -## Feature -- Improved __add__ new block. +If not passed, the block will belong to `uncategorized` blocks (default). ## Doc - Improved `registry` and `getting started` vignettes. diff --git a/R/registry.R b/R/registry.R index 5b70a599..964c55b5 100644 --- a/R/registry.R +++ b/R/registry.R @@ -69,7 +69,7 @@ block_registry <- new.env() #' #' @rdname available_blocks #' @export -register_block <- function(constructor, name, description, category, classes, input, +register_block <- function(constructor, name, description, category = "uncategorized", classes, input, output, package = NA_character_) { descr <- new_block_descr(constructor, name, description, category, classes, input, @@ -87,7 +87,7 @@ register_block <- function(constructor, name, description, category, classes, in #' @param ... Forwarded to `register_block()` #' @rdname available_blocks #' @export -register_blocks <- function(constructor, name, description, category, classes, input, +register_blocks <- function(constructor, name, description, category = "uncategorized", classes, input, output, package = NA_character_) { if (length(constructor) == 1L && !is.list(classes)) { diff --git a/man/available_blocks.Rd b/man/available_blocks.Rd index 2a18a3b5..994daf85 100644 --- a/man/available_blocks.Rd +++ b/man/available_blocks.Rd @@ -20,7 +20,7 @@ register_block( constructor, name, description, - category, + category = NULL, classes, input, output, @@ -31,7 +31,7 @@ register_blocks( constructor, name, description, - category, + category = NULL, classes, input, output,