From e10ef6433f47f6152b776237c5f408e35c186dce Mon Sep 17 00:00:00 2001 From: Pat Allan Date: Sun, 21 May 2017 14:01:30 +1000 Subject: Update respond_to? calls for second argument. Rack (since v2) has started explicitly listing the second (optional) argument for respond_to?, which matches the underlying Ruby spec. This patch fixes the calls in both C and Ruby approaches. However, rb_respond_to only accepts a single argument - differing from the Ruby side of things - so perhaps this patch isn't quite perfect (and my C skills are very limited, so the whole thing could use a review). --- ext/clogger_ext/clogger.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ext') diff --git a/ext/clogger_ext/clogger.c b/ext/clogger_ext/clogger.c index 481dd61..622c98c 100644 --- a/ext/clogger_ext/clogger.c +++ b/ext/clogger_ext/clogger.c @@ -963,8 +963,12 @@ static VALUE clogger_init_copy(VALUE clone, VALUE orig) * used to delegate +:to_path+ checks for Rack webservers that optimize * static file serving */ -static VALUE respond_to(VALUE self, VALUE method) +static VALUE respond_to(int argc, VALUE *argv, VALUE self) { + VALUE method, include_all; + rb_scan_args(argc, argv, "11", &method, &include_all); + if (NIL_P(include_all)) include_all = Qfalse; + struct clogger *c = clogger_get(self); ID id = rb_to_id(method); @@ -1044,7 +1048,7 @@ void Init_clogger_ext(void) rb_define_method(cClogger, "wrap_body?", clogger_wrap_body, 0); rb_define_method(cClogger, "reentrant?", clogger_reentrant, 0); rb_define_method(cClogger, "to_path", to_path, 0); - rb_define_method(cClogger, "respond_to?", respond_to, 1); + rb_define_method(cClogger, "respond_to?", respond_to, -1); rb_define_method(cClogger, "body", body, 0); CONST_GLOBAL_STR(REMOTE_ADDR); CONST_GLOBAL_STR(HTTP_X_FORWARDED_FOR); -- cgit v1.2.3-24-ge0c7