From 7e56c8af053fcdc93099df5165c1379927872387 Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 6 Sep 2021 04:11:24 +0900 Subject: [PATCH] No need to use max_by when array.size == 1 --- lib/reline/key_stroke.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/reline/key_stroke.rb b/lib/reline/key_stroke.rb index e097924aec..3b3f16ed77 100644 --- a/lib/reline/key_stroke.rb +++ b/lib/reline/key_stroke.rb @@ -70,8 +70,8 @@ def match_status(input) key_mapping.keys.select { |lhs| lhs.start_with? input }.tap { |it| - return :matched if it.size == 1 && (it.max_by(&:size)&.== input) - return :matching if it.size == 1 && (it.max_by(&:size)&.!= input) + return :matched if it.size == 1 && (it[0] == input) + return :matching if it.size == 1 && (it[0] != input) return :matched if it.max_by(&:size)&.size&.< input.size return :matching if it.size > 1 }