mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Prefer String#ljust over String#<< for padding
This commit is contained in:
parent
2f99da00c7
commit
73f9cd2da4
1 changed files with 2 additions and 3 deletions
|
@ -193,9 +193,8 @@ module ActiveRecord
|
|||
# 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
|
||||
|
|
Loading…
Reference in a new issue