Skip to content

Commit 06045e0

Browse files
committed
Remove unused reverse case in bigdecimal add_spaces_to_s
1 parent 2e80322 commit 06045e0

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

lib/truffle/bigdecimal.rb

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,12 @@ def to_s(format = 'E')
242242

243243
format '%s%s.%s',
244244
prefix,
245-
add_spaces_to_s(before_dot, false, space_frequency),
246-
add_spaces_to_s(after_dot, false, space_frequency)
245+
add_spaces_to_s(before_dot, space_frequency),
246+
add_spaces_to_s(after_dot, space_frequency)
247247
else
248248
format '%s0.%se%d',
249249
prefix,
250-
add_spaces_to_s(unscaled_value, false, space_frequency),
250+
add_spaces_to_s(unscaled_value, space_frequency),
251251
exponent_value
252252
end
253253
else
@@ -270,19 +270,14 @@ def self._load(data)
270270
BigDecimal(data.split(':').last)
271271
end
272272

273-
private def add_spaces_to_s(string, reverse, space_frequency)
273+
private def add_spaces_to_s(string, space_frequency)
274274
return string if space_frequency == 0
275275

276276
remainder = string.size % space_frequency
277-
shift = reverse ? remainder : 0
278-
pieces = (string.size / space_frequency).times.map { |i| string[space_frequency*i + shift, space_frequency] }
277+
pieces = (string.size / space_frequency).times.map { |i| string[space_frequency*i, space_frequency] }
279278

280279
if remainder > 0
281-
if reverse
282-
pieces.unshift string[0...remainder]
283-
else
284-
pieces.push string[-remainder..-1]
285-
end
280+
pieces.push string[-remainder..-1]
286281
end
287282

288283
pieces.join ' '

0 commit comments

Comments
 (0)