Merge pull request #15477 from reitermarkus/macosversionerror
Fix `MacOSVersionError` deprecation.
This commit is contained in:
commit
09842e1559
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user