Skip to content

Commit

Permalink
Rescue Ruby 3 errors for SortedSet
Browse files Browse the repository at this point in the history
  • Loading branch information
ggilder committed Apr 9, 2021
1 parent 4969096 commit 8c5b75f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/commander/user_interaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,13 @@ def method_missing(method_name, *arguments, &block)
# All Classes that respond to #parse
# Ignore constants that trigger deprecation warnings
available_classes = (Object.constants - DEPRECATED_CONSTANTS).map do |const|
Object.const_get(const)
end.select do |const|
begin
Object.const_get(const)
rescue RuntimeError
# Rescue errors in Ruby 3 for SortedSet:
# The `SortedSet` class has been extracted from the `set` library.
end
end.compact.select do |const|
const.class == Class && const.respond_to?(:parse)
end

Expand Down

0 comments on commit 8c5b75f

Please sign in to comment.