Skip to contents

as_servers() turns an existing object into a servers object. This is in contrast with class_servers(), which builds a servers object from individual properties.

Usage

as_servers(x, ...)

Arguments

x

The object to coerce. Must be empty or have names "name", "email", and/or "url", or names that can be coerced to those names via snakecase::to_snake_case(). Extra names are ignored.

...

These dots are for future extensions and must be empty.

Value

A servers object as returned by class_servers().

Examples

as_servers()
#> <rapid::servers>
#>  @ url        : chr(0) 
#>  @ description: chr(0) 
#>  @ variables  : <rapid::server_variables>  list()
as_servers(
  list(
    list(
      url = "https://development.gigantic-server.com/v1",
      description = "Development server"
    ),
    list(
      url = "https://staging.gigantic-server.com/v1",
      description = "Staging server"
    ),
    list(
      url = "https://api.gigantic-server.com/v1",
      description = "Production server"
    )
  )
)
#> <rapid::servers>
#>  @ url        : chr [1:3] "https://development.gigantic-server.com/v1" ...
#>  @ description: chr [1:3] "Development server" "Staging server" "Production server"
#>  @ variables  : <rapid::server_variables>  list()