diff options
author | Hiroshi SHIBATA <[email protected]> | 2021-05-17 11:59:59 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2021-05-28 11:52:32 +0900 |
commit | f7d661e783e02f87e1e0d0d67b1ca2ed306a1904 (patch) | |
tree | abf49de2ba766872075576e38c9f819c7040fa21 /lib/rubygems | |
parent | ded7dd9ccc6d084c5e65689ddcbcd27df703e58e (diff) |
[rubygems/rubygems] Try fix ruby-core CI
* Port
https://github.com/ruby/ruby/commit/8e91b969df08b7a2eb27a5d6d38733eea42dc7ad
from ruby-core, and make it compatible with psych 3 & 4.
Diffstat (limited to 'lib/rubygems')
-rw-r--r-- | lib/rubygems/test_case.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index 8dde20452e..b3e23360ed 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -692,6 +692,28 @@ class Gem::TestCase < Test::Unit::TestCase path end + ## + # Load a YAML string, the psych 3 way + + def load_yaml(yaml) + if YAML.respond_to?(:unsafe_load) + YAML.unsafe_load(yaml) + else + YAML.load(yaml) + end + end + + ## + # Load a YAML file, the psych 3 way + + def load_yaml_file(file) + if YAML.respond_to?(:unsafe_load_file) + YAML.unsafe_load_file(file) + else + YAML.load_file(file) + end + end + def all_spec_names Gem::Specification.map(&:full_name) end |