diff --git a/lib/versioning/ruby/strategies/replace.ts b/lib/versioning/ruby/strategies/replace.ts
index 0fde62c4b342b36199344dc0a2f92db104d7e8fb..447a17baa87f8dd7cad2d35706caed48817d3021 100644
--- a/lib/versioning/ruby/strategies/replace.ts
+++ b/lib/versioning/ruby/strategies/replace.ts
@@ -9,7 +9,15 @@ export default ({ to, range }: { range: string; to: string }): string => {
     .split(',')
     .map(part => part.trim())
     .pop();
-  const newLastPart = bump({ to, range: lastPart });
-  // TODO: match precision
+  const lastPartPrecision = lastPart.split('.').length;
+  const toPrecision = to.split('.').length;
+  let massagedTo: string = to;
+  if (!lastPart.startsWith('<') && toPrecision > lastPartPrecision) {
+    massagedTo = to
+      .split('.')
+      .slice(0, lastPartPrecision)
+      .join('.');
+  }
+  const newLastPart = bump({ to: massagedTo, range: lastPart });
   return range.replace(lastPart, newLastPart);
 };
diff --git a/test/versioning/ruby.spec.ts b/test/versioning/ruby.spec.ts
index a51608611d27ce0db3a853f1f158edb34fb78243..a9e8ee7165308fc13cff0640f62552c2766c2ad5 100644
--- a/test/versioning/ruby.spec.ts
+++ b/test/versioning/ruby.spec.ts
@@ -423,12 +423,13 @@ describe('semverRuby', () => {
         ['~> 1.0.3', '~> 1.0.3', 'replace', '1.0.0', '1.0.4'],
         ['~> 4.7, >= 4.7.4', '~> 4.7, >= 4.7.4', 'replace', '1.0.0', '4.7.9'],
         [
-          '>= 2.0.0, <= 2.20.0',
+          '>= 2.0.0, <= 2.20.1',
           '>= 2.0.0, <= 2.15',
           'replace',
           '2.15.0',
-          '2.20.0',
+          '2.20.1',
         ],
+        ['~> 6.0.0', '~> 5.2.0', 'replace', '5.2.4.1', '6.0.2.1'],
       ].forEach(([expected, current, range, from, to]) => {
         expect(semverRuby.getNewValue(current, range as any, from, to)).toEqual(
           expected