lib/roda.rb in roda-3.71.0 vs lib/roda.rb in roda-3.72.0

- old
+ new

@@ -86,10 +86,11 @@ if meth.is_a?(String) meth = roda_method_name(meth) end call_meth = meth + # RODA4: Switch to false # :warn in last Roda 3 version if (check_arity = opts.fetch(:check_arity, true)) && !block.lambda? required_args, optional_args, rest, keyword = _define_roda_method_arg_numbers(block) if keyword == :required && (expected_arity == 0 || expected_arity == 1) raise RodaError, "cannot use block with required keyword arguments when calling define_roda_method with expected arity #{expected_arity}" @@ -115,9 +116,12 @@ undef_method temp_method private meth alias_method meth, meth meth = :"#{meth}_arity" elsif required_args > 1 + if check_arity == :warn + RodaPlugins.warn "Arity mismatch in block passed to define_roda_method. Expected Arity 1, but multiple arguments required for #{block.inspect}" + end b = block block = lambda{|r| instance_exec(r, &b)} # Fallback end when :any if check_dynamic_arity = opts.fetch(:check_dynamic_arity, check_arity)