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
This commit is contained in:
parent
e7fdfefd5c
commit
8ea464a9c1
@ -28,12 +28,20 @@ module Gem
|
|||||||
|
|
||||||
if ::YAML.respond_to? :safe_load
|
if ::YAML.respond_to? :safe_load
|
||||||
def self.safe_load input
|
def self.safe_load input
|
||||||
|
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)
|
::YAML.safe_load(input, WHITELISTED_CLASSES, WHITELISTED_SYMBOLS, true)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.load input
|
def self.load input
|
||||||
|
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])
|
::YAML.safe_load(input, [::Symbol])
|
||||||
end
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
unless Gem::Deprecate.skip
|
unless Gem::Deprecate.skip
|
||||||
warn "YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0)."
|
warn "YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0)."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user