Skip to content

Commit

Permalink
Register methods, fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Sep 20, 2023
1 parent 76c1c54 commit ead84fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ S3method(jq,connection)
S3method(jq,default)
S3method(jq,jqr)
S3method(jq,json)
S3method(jqr,connection)
S3method(jqr,default)
S3method(print,jq_query)
S3method(print,jqson)
export("%>%")
Expand Down Expand Up @@ -52,6 +54,7 @@ export(join)
export(join_)
export(jq)
export(jq_flags)
export(jqr)
export(jqr_feed)
export(jqr_new)
export(keys)
Expand Down
7 changes: 5 additions & 2 deletions R/jqr.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,21 @@ jqr_feed <- function(jqr_program, json, unlist = TRUE, finalize = FALSE){
return(out)
}

#' @export
jqr <- function(x, ...) {
UseMethod("jqr", x)
}

jqr.default <- function(x, query, flags){
#' @export
jqr.default <- function(x, query, flags, ...){
stopifnot(is.character(query))
stopifnot(is.numeric(flags))
program <- jqr_new(query, flags = flags)
jqr_feed(program, json = x, unlist = TRUE, finalize = TRUE)
}

jqr.connection <- function(x, query, flags, out = NULL){
#' @export
jqr.connection <- function(x, query, flags, out = NULL, ...){
con <- x
val <- invisible()
stopifnot(inherits(con, 'connection'))
Expand Down

0 comments on commit ead84fa

Please sign in to comment.