From d07060c42a7d3fd1ff9a3024e5f064448578a722 Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 6 Sep 2021 04:11:24 +0900 Subject: [PATCH] [ruby/reline] No need to use max_by when array.size == 1 https://github.com/ruby/reline/commit/7e56c8af05 --- 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 @@ class Reline::KeyStroke 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 }