lib/balloon/uploader.rb in balloon-1.1.0 vs lib/balloon/uploader.rb in balloon-1.1.1
- old
+ new
@@ -22,17 +22,17 @@
uploader_file_ext = Balloon::FileExtension.new(uploader_file)
file_mime_type = uploader_file_ext.mime_type
if self.respond_to?(:uploader_mimetype_white)
- if !uploader_mimetype_white.include?(file_mime_type)
+ if !uploader_mimetype_white.include?(file_mime_type)
raise Balloon::DownloadError, I18n.translate(:"errors.messages.down_mime_error")
end
end
-
+
if self.respond_to?(:uploader_mimetype_black)
- if !uploader_mimetype_black.include?(file_mime_type)
+ if !uploader_mimetype_black.include?(file_mime_type)
raise Balloon::DownloadError, I18n.translate(:"errors.messages.down_mime_error")
end
end
generate_cache_directory
@@ -41,11 +41,12 @@
@meta = {
width: @cache_meta[:width],
height: @cache_meta[:height],
size: @cache_meta[:size],
mime_type: @cache_meta[:mime_type],
- extension: @cache_meta[:extension]
+ extension: @cache_meta[:extension],
+ data: @cache_meta[:data]
}
end
def url(size_name = nil); end
@@ -68,10 +69,10 @@
define_method "uploader_size" do; list; end
end
def uploader_name_format(info)
define_method "uploader_name_format" do
- name = info[:name].nil? ? info[:name] : info[:name].call(self)
+ name = info[:name].is_a?(Proc) ? info[:name].call(self) : info[:name].to_s
{ name: name, format: info[:format] }
end
end
def uploader_type_format(ext)