diff options
author | Mau Magnaguagno <maumagnaguagno@gmail.com> | 2023-11-26 04:07:14 -0300 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-11-27 01:35:08 +0000 |
commit | 67ee91a3058e9d918add38ed02205e7383f00fad (patch) | |
tree | 193648f94eb5442b176d952dd221103d0617f7f3 /ext | |
parent | 52c7e43b8797de0d042d05ecf6fc4a883c5c372f (diff) | |
download | ruby-67ee91a3058e9d918add38ed02205e7383f00fad.tar.gz |
[ruby/psych] Prefer each_char in Psych::Visitors::Visitor::ToRuby#deserialize
Use safe navigation operator with each_char to remove empty strings and improve readability.
https://github.com/ruby/psych/commit/5fe714b216
Diffstat (limited to 'ext')
-rw-r--r-- | ext/psych/lib/psych/visitors/to_ruby.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb index 8614251ca9..f0fda9bdbc 100644 --- a/ext/psych/lib/psych/visitors/to_ruby.rb +++ b/ext/psych/lib/psych/visitors/to_ruby.rb @@ -101,7 +101,7 @@ module Psych source = $1 options = 0 lang = nil - ($2 || '').split('').each do |option| + $2&.each_char do |option| case option when 'x' then options |= Regexp::EXTENDED when 'i' then options |= Regexp::IGNORECASE |