diff options
author | Hiroshi SHIBATA <[email protected]> | 2023-03-09 15:42:07 +0900 |
---|---|---|
committer | git <[email protected]> | 2023-03-09 13:37:06 +0000 |
commit | 3926ad578c312ddd2ff5221b96ef077b9e24e612 (patch) | |
tree | f8340c8f608e342f1fbba9ccb05e1f56c6b87a45 | |
parent | 44a0711eab7fbc71ac2c8ff489d8c53e97a8fe75 (diff) |
[rubygems/rubygems] Drop to support Psych 3.0 bundled at Ruby 2.5
https://github.com/rubygems/rubygems/commit/a6650c2c96
-rw-r--r-- | lib/rubygems/safe_yaml.rb | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/lib/rubygems/safe_yaml.rb b/lib/rubygems/safe_yaml.rb index 5a98505598..3a1ae3bcfc 100644 --- a/lib/rubygems/safe_yaml.rb +++ b/lib/rubygems/safe_yaml.rb @@ -24,34 +24,12 @@ module Gem runtime ].freeze - if ::Psych.respond_to? :safe_load - def self.safe_load(input) - if Gem::Version.new(Psych::VERSION) >= Gem::Version.new("3.1.0.pre1") - ::Psych.safe_load(input, permitted_classes: PERMITTED_CLASSES, permitted_symbols: PERMITTED_SYMBOLS, aliases: true) - else - ::Psych.safe_load(input, PERMITTED_CLASSES, PERMITTED_SYMBOLS, true) - end - end - - def self.load(input) - if Gem::Version.new(Psych::VERSION) >= Gem::Version.new("3.1.0.pre1") - ::Psych.safe_load(input, permitted_classes: [::Symbol]) - else - ::Psych.safe_load(input, [::Symbol]) - end - end - else - unless Gem::Deprecate.skip - warn "Psych safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0)." - end - - def self.safe_load(input, *args) - ::Psych.load input - end + def self.safe_load(input) + ::Psych.safe_load(input, permitted_classes: PERMITTED_CLASSES, permitted_symbols: PERMITTED_SYMBOLS, aliases: true) + end - def self.load(input) - ::Psych.load input - end + def self.load(input) + ::Psych.safe_load(input, permitted_classes: [::Symbol]) end end end |