Skip to content

Commit

Permalink
[ruby/psych] Prefer each_char in Psych::Visitors::Visitor::ToRuby#des…
Browse files Browse the repository at this point in the history
…erialize

Use safe navigation operator with each_char to remove empty strings and improve readability.

ruby/psych@5fe714b216
  • Loading branch information
Maumagnaguagno authored and matzbot committed Nov 27, 2023
1 parent 52c7e43 commit 67ee91a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ext/psych/lib/psych/visitors/to_ruby.rb
Expand Up @@ -101,7 +101,7 @@ def deserialize o
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
Expand Down

0 comments on commit 67ee91a

Please sign in to comment.