Skip to content

Commit

Permalink
YJIT: skip to_a in format_number (ruby#8815)
Browse files Browse the repository at this point in the history
String#chars returns an array instead of an enumerator since Ruby 2.0.
  • Loading branch information
Maumagnaguagno authored Nov 1, 2023
1 parent 909afcb commit d3ea907
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion yjit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def print_counters(counters, out:, prefix:, prompt:, optional: false) # :nodoc:
# Format large numbers with comma separators for readability
def format_number(pad, number)
integer, decimal = number.to_s.split(".")
d_groups = integer.chars.to_a.reverse.each_slice(3)
d_groups = integer.chars.reverse.each_slice(3)
with_commas = d_groups.map(&:join).join(',').reverse
formatted = [with_commas, decimal].compact.join(".")
formatted.rjust(pad, ' ')
Expand Down

0 comments on commit d3ea907

Please sign in to comment.