Merge pull request #15477 from reitermarkus/macosversionerror

Fix `MacOSVersionError` deprecation.
This commit is contained in:
Mike McQuaid 2023-05-24 12:50:12 +01:00 committed by GitHub
commit 09842e1559
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,9 +139,23 @@ end
require "lazy_object"
MacOSVersionError = LazyObject.new do # rubocop:disable Style/MutableConstant
# odeprecated "MacOSVersionError", "MacOSVersion::Error"
MacOSVersion::Error
# `LazyObject` does not work for exceptions when used in `rescue` statements.
class Object
class << self
module MacOSVersionErrorCompat
def const_missing(name)
if name == :MacOSVersionError
# odeprecated "MacOSVersionError", "MacOSVersion::Error"
return MacOSVersion::Error
end
super
end
end
private_constant :MacOSVersionErrorCompat
prepend MacOSVersionErrorCompat
end
end
module MacOSVersions