From d59e635a77044212daf9f995183ea1fb5e4538d5 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Mon, 10 Sep 2018 10:03:44 +0800 Subject: [PATCH] Rename `FileHelper.images` to `FileHelper.supported_images`. --- lib/file_helper.rb | 8 +++----- lib/validators/upload_validator.rb | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/file_helper.rb b/lib/file_helper.rb index 21c0cd79bce..d5410e00055 100644 --- a/lib/file_helper.rb +++ b/lib/file_helper.rb @@ -100,14 +100,12 @@ class FileHelper ).optimize_image!(filename) end - private - - def self.images - @@images ||= Set.new %w{jpg jpeg png gif tif tiff bmp svg webp ico} + def self.supported_images + @@supported_images ||= Set.new %w{jpg jpeg png gif tif tiff bmp svg webp ico} end def self.images_regexp - @@images_regexp ||= /\.(#{images.to_a.join("|")})$/i + @@images_regexp ||= /\.(#{supported_images.to_a.join("|")})$/i end end diff --git a/lib/validators/upload_validator.rb b/lib/validators/upload_validator.rb index 60074a197f9..72bc1febadd 100644 --- a/lib/validators/upload_validator.rb +++ b/lib/validators/upload_validator.rb @@ -74,11 +74,11 @@ class Validators::UploadValidator < ActiveModel::Validator end def authorized_images(upload) - authorized_extensions(upload) & FileHelper.images + authorized_extensions(upload) & FileHelper.supported_images end def authorized_attachments(upload) - authorized_extensions(upload) - FileHelper.images + authorized_extensions(upload) - FileHelper.supported_images end def authorizes_all_extensions?(upload)