Skip to content

Commit

Permalink
Prefer String#ljust over String#<< for padding
Browse files Browse the repository at this point in the history
  • Loading branch information
lsylvester authored and schneems committed Oct 17, 2018
1 parent 2f99da0 commit 73f9cd2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions activerecord/lib/active_record/integration.rb
Expand Up @@ -193,9 +193,8 @@ def can_use_fast_cache_version?(timestamp)
# to account for this we pad the output with zeros
def raw_timestamp_to_cache_version(timestamp)
key = timestamp.delete("- :.")
padding = 20 - key.length
if padding != 0
key << "0" * padding
if key.length < 20
key.ljust(20, "0")
else
key
end
Expand Down

0 comments on commit 73f9cd2

Please sign in to comment.