Skip to content

Commit

Permalink
♻️ Use Integer.try_convert (new in ruby 3.1+)
Browse files Browse the repository at this point in the history
Now that the minimum ruby version is v3.1.0, we can use
Integer.try_convert.
  • Loading branch information
nevans committed Sep 13, 2024
1 parent 74a39b9 commit c198fcc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/net/imap/sequence_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1284,8 +1284,7 @@ def input_to_tuples(obj)
# String, Set, Array, or... any type of object.
def input_try_convert(input)
SequenceSet.try_convert(input) ||
# Integer.try_convert(input) || # ruby 3.1+
input.respond_to?(:to_int) && Integer(input.to_int) ||
Integer.try_convert(input) ||
String.try_convert(input) ||
input
end
Expand Down

0 comments on commit c198fcc

Please sign in to comment.