From a146858a143ab14cf1af3bda3e0705c63404c7f1 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 4 Jul 2017 14:54:38 +0200 Subject: [PATCH] Extract explaining method --- lib/active_file/sites/gcs_site.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/active_file/sites/gcs_site.rb b/lib/active_file/sites/gcs_site.rb index d9164621c2f3f..71f065c6087c8 100644 --- a/lib/active_file/sites/gcs_site.rb +++ b/lib/active_file/sites/gcs_site.rb @@ -32,7 +32,7 @@ def byte_size(key) end def checksum(key) - file_for(key).md5.unpack("m0").first.unpack("H*").first + convert_to_hex base64: file_for(key).md5 end @@ -40,4 +40,8 @@ def checksum(key) def file_for(key) bucket.file(key) end + + def convert_to_hex(base64:) + base64.unpack("m0").first.unpack("H*").first + end end