1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Prefer respond_to? to defined? in MSpec

This commit is contained in:
Benoit Daloze 2021-05-17 20:12:39 +02:00
parent ee611341c9
commit 2321ade41d

View file

@ -30,7 +30,7 @@ class MatchYAMLMatcher
def valid_yaml?(obj)
require 'yaml'
begin
if defined?(YAML.unsafe_load)
if YAML.respond_to?(:unsafe_load)
YAML.unsafe_load(obj)
else
YAML.load(obj)