Skip to content

Commit

Permalink
doc: style the pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
Cervangirard committed Dec 5, 2024
1 parent 976b5b1 commit ee919dd
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions R/connectors.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#' connections in your project.
#'
#' @param ... Named individual [connector] objects
#'
#'
#' @examples
#' # Create connectors objects
#'
Expand All @@ -26,12 +26,11 @@
#'
#' @export
connectors <- function(...) {

x <- rlang::list2(...)

if(!is.null(x$atasources) & !inherits(x$datasources, "cnts_datasources")){
if (!is.null(x$atasources) & !inherits(x$datasources, "cnts_datasources")) {
cli::cli_abort("'datasources' is a reserved name. It cannot be used as a name for a data source.")
}
}

if (is.null(x$datasources)) {
cnts <- substitute(list(...))
Expand All @@ -49,8 +48,8 @@ connectors <- function(...) {
}

#' @export
print.connectors <- function(x, ...){
print_connectors(x,...)
print.connectors <- function(x, ...) {
print_connectors(x, ...)
}

#' @noRd
Expand Down Expand Up @@ -115,7 +114,7 @@ as_datasources <- function(...) {
#' # Assume we have a 'my_connectors' object with a 'datasources' attribute
#' my_connectors <- list()
#' attr(my_connectors, "datasources") <- list(source1 = "data1", source2 = "data2")
#'
#'
#' # Using the function
#' result <- datasources(my_connectors)
#' print(result)
Expand All @@ -134,7 +133,7 @@ datasources <- function(connectors) {
#'
#' @return A list with class "nested_connectors" containing the provided arguments.
#' @export
nested_connectors <- function(...){
nested_connectors <- function(...) {
x <- rlang::list2(...)
structure(
x,
Expand All @@ -143,6 +142,6 @@ nested_connectors <- function(...){
}

#' @export
print.nested_connectors <- function(x, ...){
print_connectors(x,...)
}
print.nested_connectors <- function(x, ...) {
print_connectors(x, ...)
}

0 comments on commit ee919dd

Please sign in to comment.