Url: Url

UrlR Documentation

Url

Description

A validated URL field. Validation occurs during both serialization and deserialization

Super classes

staypuft::FieldABC -> staypuft::Field -> Url

Methods

Public methods

Inherited methods

Method new()

Create a new Url object

Usage
Url$new(..., relative = FALSE, schemes = NULL, require_tld = TRUE)
Arguments
relative

Whether to allow relative URLs. NOT WORKING YET

schemes

Valid schemes. By default http, https, ftp, and ftps are allowed

require_tld

Whether to reject non-FQDN hostnames. NOT WORKING YET


Method validate_url()

Usage
Url$validate_url(relative = FALSE, schemes = NULL, require_tld = TRUE)

Method clone()

The objects of this class are cloneable with this method.

Usage
Url$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

aschema <- Schema$new("aSchema",
  url = fields$url()
)
aschema
aschema$load(list(url = "https://ropensci.org/")) # good
if (interactive()) aschema$load(list(url = 6)) # bad

sch <- Schema$new("anotherschema",
  url = fields$url(schemes = c("https", "ftps"))
)
if (interactive()) sch$load(list(url = "http://google.com")) # bad

ropensci/staypuft documentation built on Sept. 9, 2022, 4:35 p.m.