Skip to contents

uri matcher

Public fields

pattern

(character) pattern holder

regex

a logical

query_params

a list, or NULL if empty

partial

bool, default: FALSE

partial_type

a string, default: NULL

Methods


Method new()

Create a new UriPattern object

Usage

UriPattern$new(pattern = NULL, regex_pattern = NULL)

Arguments

pattern

(character) a uri, as a character string. if scheme is missing, it is added (we assume http)

regex_pattern

(character) a uri as a regex character string, see base::regex. if scheme is missing, it is added (we assume http)

Returns

A new UriPattern object


Method matches()

Match a uri against a pattern

Usage

UriPattern$matches(uri)

Arguments

uri

(character) a uri

Returns

a boolean


Method pattern_matches()

Match a URI

Usage

UriPattern$pattern_matches(uri)

Arguments

uri

(character) a uri

Returns

a boolean


Method query_params_matches()

Match query parameters of a URI

Usage

UriPattern$query_params_matches(uri)

Arguments

uri

(character) a uri

Returns

a boolean


Method extract_query()

Extract query parameters as a named list

Usage

UriPattern$extract_query(uri)

Arguments

uri

(character) a uri

Returns

named list, or NULL if no query parameters


Method add_query_params()

Add query parameters to the URI

Usage

UriPattern$add_query_params(query_params)

Arguments

query_params

(list|character) list or character

Returns

nothing returned, updates uri pattern


Method to_s()

Print pattern for easy human consumption

Usage

UriPattern$to_s()

Returns

a string


Method clone()

The objects of this class are cloneable with this method.

Usage

UriPattern$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.