From be47c82f82a9774c19645dbf2fc8976a5fd143c3 Mon Sep 17 00:00:00 2001 From: nagatech Date: Sat, 26 Jan 2019 13:49:54 +0900 Subject: [PATCH] Refactor SanitizedFile#path --- lib/carrierwave/sanitized_file.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/carrierwave/sanitized_file.rb b/lib/carrierwave/sanitized_file.rb index 0c889941e..b5ba07840 100644 --- a/lib/carrierwave/sanitized_file.rb +++ b/lib/carrierwave/sanitized_file.rb @@ -114,12 +114,11 @@ def size # [String, nil] the path where the file is located. # def path - unless @file.blank? - if is_path? - File.expand_path(@file) - elsif @file.respond_to?(:path) and not @file.path.blank? - File.expand_path(@file.path) - end + return if @file.blank? + if is_path? + File.expand_path(@file) + elsif @file.respond_to?(:path) && !@file.path.blank? + File.expand_path(@file.path) end end