From 73f9cd2da452c97061a7b01d3d8e9f480950fe80 Mon Sep 17 00:00:00 2001 From: lsylvester Date: Wed, 17 Oct 2018 10:48:11 -0500 Subject: Prefer String#ljust over String#<< for padding --- activerecord/lib/active_record/integration.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/integration.rb b/activerecord/lib/active_record/integration.rb index db7200bceb..04d0d46d3e 100644 --- a/activerecord/lib/active_record/integration.rb +++ b/activerecord/lib/active_record/integration.rb @@ -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 -- cgit v1.2.3