Skip to content

Commit

Permalink
Prefer each_char in Psych::Visitors::Visitor::ToRuby#deserialize
Browse files Browse the repository at this point in the history
Use safe navigation operator with each_char to remove empty strings and improve readability.
  • Loading branch information
Maumagnaguagno authored Nov 26, 2023
1 parent 51cc86f commit 5fe714b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/psych/visitors/to_ruby.rb
Original file line number Diff line number Diff line change
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 5fe714b

Please sign in to comment.