ruby-changes:66240
From: Benoit <ko1@a...>
Date: Tue, 18 May 2021 03:19:14 +0900 (JST)
Subject: [ruby-changes:66240] 2321ade41d (master): Prefer respond_to? to defined? in MSpec
https://git.ruby-lang.org/ruby.git/commit/?id=2321ade41d From 2321ade41d9644207efb262137a3748b85b6c635 Mon Sep 17 00:00:00 2001 From: Benoit Daloze <eregontp@g...> Date: Mon, 17 May 2021 20:12:39 +0200 Subject: Prefer respond_to? to defined? in MSpec --- spec/mspec/lib/mspec/matchers/match_yaml.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/mspec/lib/mspec/matchers/match_yaml.rb b/spec/mspec/lib/mspec/matchers/match_yaml.rb index 664ca73..3056162 100644 --- a/spec/mspec/lib/mspec/matchers/match_yaml.rb +++ b/spec/mspec/lib/mspec/matchers/match_yaml.rb @@ -30,7 +30,7 @@ class MatchYAMLMatcher https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/matchers/match_yaml.rb#L30 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) -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/