Prefer respond_to? to defined? in MSpec · ruby/mspec@0091e8a (original) (raw)
Navigation Menu
- GitHub Copilot Write better code with AI
- GitHub Models New Manage and compare prompts
- GitHub Advanced Security Find and fix vulnerabilities
- Actions Automate any workflow
- Codespaces Instant dev environments
- Issues Plan and track work
- Code Review Manage code changes
- Discussions Collaborate outside of code
- Code Search Find more, search less
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Commit 0091e8a
Prefer respond_to? to defined? in MSpec
File tree
1 file changed
lines changed
1 file changed
lines changed
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -30,7 +30,7 @@ def clean_yaml(yaml) | ||
30 | 30 | def valid_yaml?(obj) |
31 | 31 | require 'yaml' |
32 | 32 | begin |
33 | -if defined?(YAML.unsafe_load) | |
33 | +if YAML.respond_to?(:unsafe_load) | |
34 | 34 | YAML.unsafe_load(obj) |
35 | 35 | else |
36 | 36 | YAML.load(obj) |