Skip to content

Commit

Permalink
refactor: use Array#index instead of Enumerable#each_with_index (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
supercaracal authored Jan 1, 2025
1 parent 4d0656a commit f440440
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/redis_client/cluster/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,8 @@ def determine_first_key_position(command) # rubocop:disable Metrics/CyclomaticCo
end

def determine_optional_key_position(command, option_name)
command.each_with_index do |e, i|
return i + 1 if e.to_s.casecmp(option_name).zero?
end

0
i = command.index { |v| v.to_s.casecmp(option_name).zero? }
i.nil? ? 0 : i + 1
end
end
end
Expand Down

0 comments on commit f440440

Please sign in to comment.