From 5caf08c9ea9d4d07e6e89a2cdc2356dbd5f9b6b4 Mon Sep 17 00:00:00 2001 From: David Boot Date: Wed, 11 Aug 2021 13:29:32 +0200 Subject: [PATCH] Handle keyword arguments for Ruby 2.6 --- lib/image_vise/pipeline.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/image_vise/pipeline.rb b/lib/image_vise/pipeline.rb index 63aa7c0..4d8ee9b 100644 --- a/lib/image_vise/pipeline.rb +++ b/lib/image_vise/pipeline.rb @@ -27,9 +27,16 @@ def empty? @ops.empty? end - def method_missing(method_name, args = {}, &blk) - operator_builder = ImageVise.operator_from(method_name) - self << operator_builder.new(**args) + if RUBY_VERSION.start_with?("2.6") + def method_missing(method_name, *args, &blk) + operator_builder = ImageVise.operator_from(method_name) + self << operator_builder.new(*args) + end + else + def method_missing(method_name, args = {}, &blk) + operator_builder = ImageVise.operator_from(method_name) + self << operator_builder.new(**args) + end end def respond_to_missing?(method_name, *a)