From a482847bd85dfed00a975ec4f1b956953c3173d8 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Tue, 27 Feb 2024 16:07:23 +0100 Subject: [PATCH] Improve code readability Refine method argument check for clarity: Both `(method.arity + args.size == 0)` and `(method.arity + args.size) == 0` are equivalent due to operator precedence, but the latter is preferred for improved readability. Close #56 --- lib/hawk/model/proxy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hawk/model/proxy.rb b/lib/hawk/model/proxy.rb index a22e170..956f8cd 100644 --- a/lib/hawk/model/proxy.rb +++ b/lib/hawk/model/proxy.rb @@ -98,7 +98,7 @@ def method_missing(meth, *args, &block) # If the method accepts a variable number of parameters, and # the last provided one is an hash, merge the scoped params. - elsif method.arity < 0 && (method.arity + args.size == 0) && args.last.is_a?(Hash) + elsif method.arity < 0 && (method.arity + args.size) == 0 && args.last.is_a?(Hash) args[-1] = params.deep_merge(args[-1]) end