Skip to content

Commit

Permalink
Reduce cognitive complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
Steam Deck User committed Apr 29, 2024
1 parent 5080992 commit fba7e16
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/aasm/core/invokers/literal_invoker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ def exec_subject
raise(*record_error) unless record.respond_to?(subject, true)
return record.__send__(subject) if subject_arity.zero?
return record.__send__(subject, *args) if subject_arity < 0
handle_args
end
# rubocop:enable Metrics/AbcSize

def handle_args
req_args = args[0..(subject_arity - 1)]
if req_args[-1].is_a?(Hash)
positional_args = req_args[0..-2]
Expand All @@ -39,7 +44,6 @@ def exec_subject
record.__send__(subject, *req_args)
end
end
# rubocop:enable Metrics/AbcSize

def record_error
[
Expand Down

0 comments on commit fba7e16

Please sign in to comment.