Skip to contents

as_contact() turns an existing object into a contact. This is in contrast with class_contact(), which builds a contact from individual properties.

Usage

as_contact(x, ..., arg = caller_arg(x), call = caller_env())

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. This object should describe a single point of contact.

...

These dots are for future extensions and must be empty.

arg

An argument name as a string. This argument will be mentioned in error messages as the input that is at the origin of a problem.

call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

Value

A contact as returned by class_contact().

Examples

as_contact()
#> <rapid::contact>
#>  @ name : chr(0) 
#>  @ email: chr(0) 
#>  @ url  : chr(0) 
as_contact(list(name = "Jon Harmon", email = "jonthegeek@gmail.com"))
#> <rapid::contact>
#>  @ name : chr "Jon Harmon"
#>  @ email: chr "jonthegeek@gmail.com"
#>  @ url  : chr(0)