Fix MacOSVersionError deprecation.

This commit is contained in:
Markus Reiter 2023-05-23 21:43:33 +02:00
parent 8aaf99e1d7
commit 0d8004bc3c
No known key found for this signature in database
GPG Key ID: 245293B51702655B

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