Skip to content

Commit

Permalink
Improve code readability
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tagliala committed Feb 27, 2024
1 parent 3d284bd commit a482847
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/hawk/model/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a482847

Please sign in to comment.