From bda5e25c61813690207a291b98a16aadd6872edb Mon Sep 17 00:00:00 2001 From: Jon Harmon Date: Fri, 19 Apr 2024 14:43:57 -0500 Subject: [PATCH] Tweak as_api_object documentation I originally wrote this for lists, but it also works for character vectors, and may eventually expand to other objects like data frames. Thanks for catching the mismatch! Hopefully this fix makes as much sense as this can! --- R/as.R | 9 +++++---- man/as_api_object.Rd | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/R/as.R b/R/as.R index 5fae855..8938b47 100644 --- a/R/as.R +++ b/R/as.R @@ -1,12 +1,13 @@ #' Convert to a rapid-style object #' -#' Convert a named list into an object with a rapid-style class. +#' Convert an object into an object with a rapid-style class. #' #' @inheritParams rlang::args_dots_empty #' @inheritParams rlang::args_error_context -#' @param x The named list to coerce. Must be empty or have names corresponding to -#' the parameter of the `target_class`, or names that can be coerced to those -#' names via [snakecase::to_snake_case()]. Extra names are ignored. +#' @param x The object to coerce. Must be empty, or be a named list or character +#' vector having names corresponding to the parameter of the `target_class`, +#' or names that can be coerced to those names via +#' [snakecase::to_snake_case()]. Extra names are ignored. #' @param target_class The S7 class to which the object should be converted. #' @param alternate_names Character vector (optional). An optional named #' character vector, where the names are the names as they might appear in diff --git a/man/as_api_object.Rd b/man/as_api_object.Rd index 3e238c4..47e5e63 100644 --- a/man/as_api_object.Rd +++ b/man/as_api_object.Rd @@ -14,9 +14,10 @@ as_api_object( ) } \arguments{ -\item{x}{The object to coerce. Must be empty or have names corresponding to -the parameter of the \code{target_class}, or names that can be coerced to those -names via \code{\link[snakecase:caseconverter]{snakecase::to_snake_case()}}. Extra names are ignored.} +\item{x}{The object to coerce. Must be empty, or be a named list or character +vector having names corresponding to the parameter of the \code{target_class}, +or names that can be coerced to those names via +\code{\link[snakecase:caseconverter]{snakecase::to_snake_case()}}. Extra names are ignored.} \item{target_class}{The S7 class to which the object should be converted.} @@ -39,5 +40,5 @@ mentioned in error messages as the source of the error. See the An object with the specified \code{target_class}. } \description{ -Convert a named list into an object with a rapid-style class. +Convert an object into an object with a rapid-style class. }