Skip to content

Commit

Permalink
No need to use max_by when array.size == 1
Browse files Browse the repository at this point in the history
  • Loading branch information
aycabta committed Sep 5, 2021
1 parent 67f1d8d commit 7e56c8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/reline/key_stroke.rb
Expand Up @@ -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
}
Expand Down

0 comments on commit 7e56c8a

Please sign in to comment.