Skip to content

Commit

Permalink
[rubygems/rubygems] Prefer String#split with block in Gem::YAMLSerial…
Browse files Browse the repository at this point in the history
…izer#load

String#split supports a block since Ruby 2.6, avoiding intermediate array.

rubygems/rubygems@69cdf9e9d4
  • Loading branch information
Maumagnaguagno authored and hsbt committed Dec 5, 2023
1 parent 5f78935 commit 57178a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rubygems/yaml_serializer.rb
Expand Up @@ -55,7 +55,7 @@ def load(str)
stack = [res]
last_hash = nil
last_empty_key = nil
str.split(/\r?\n/).each do |line|
str.split(/\r?\n/) do |line|
if match = HASH_REGEX.match(line)
indent, key, quote, val = match.captures
convert_to_backward_compatible_key!(key)
Expand Down

0 comments on commit 57178a9

Please sign in to comment.