summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-20 02:51:09 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-20 02:51:09 +0000
commit8ea464a9c1b94bbe1f697bfd6c03e87411272701 (patch)
treedd850763cf269cdbeb312ee08bf10ec2b1425569
parente7fdfefd5ca1b23f4396230c9f34e5fa59825093 (diff)
Support keyword arguments with Pysch.safe_load provided by after Psych 3.1.0.pre1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--lib/rubygems/safe_yaml.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/rubygems/safe_yaml.rb b/lib/rubygems/safe_yaml.rb
index 789bb5e..949c7b4 100644
--- a/lib/rubygems/safe_yaml.rb
+++ b/lib/rubygems/safe_yaml.rb
@@ -28,11 +28,19 @@ module Gem
if ::YAML.respond_to? :safe_load
def self.safe_load input
- ::YAML.safe_load(input, WHITELISTED_CLASSES, WHITELISTED_SYMBOLS, true)
+ if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0.pre1')
+ ::YAML.safe_load(input, whitelist_classes: WHITELISTED_CLASSES, whitelist_symbols: WHITELISTED_SYMBOLS, aliases: true)
+ else
+ ::YAML.safe_load(input, WHITELISTED_CLASSES, WHITELISTED_SYMBOLS, true)
+ end
end
def self.load input
- ::YAML.safe_load(input, [::Symbol])
+ if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0.pre1')
+ ::YAML.safe_load(input, whitelist_classes: [::Symbol])
+ else
+ ::YAML.safe_load(input, [::Symbol])
+ end
end
else
unless Gem::Deprecate.skip