R/pkg_ref_cache_bug_reports_host.R

Defines functions pkg_ref_cache.bug_reports_host.default pkg_ref_cache.bug_reports_host

Documented in pkg_ref_cache.bug_reports_host.default

#' Get the host name of a BugReports url
#'
#' @inheritParams pkg_ref_cache
#' @family package reference cache
#' @return a \code{pkg_ref} object
#' @keywords internal
#' @noRd
pkg_ref_cache.bug_reports_host <- function(x, ...) {
  UseMethod("pkg_ref_cache.bug_reports_host")
}


#' Get the host name of a BugReports url
#'
#' @importFrom urltools domain
#' @return a \code{pkg_ref} object
#' @keywords internal
pkg_ref_cache.bug_reports_host.default <- function(x, ...) {
  if (is.null(x$bug_reports_url)) return(NULL)
  sapply(strsplit(domain(x$bug_reports_url), "\\."), function(dm) dm[length(dm)-1])
}

Try the riskmetric package in your browser

Any scripts or data that you put into this service are public.

riskmetric documentation built on Sept. 1, 2023, 1:06 a.m.