paperclip_utils 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 43be69395250e10d0d52dc24580b9c9f3d6ff4f3
4
- data.tar.gz: 63318882fbdeaedeece02d331a36597431823670
3
+ metadata.gz: edb0136a20bafc183e70c8be005f63d73e6ce48b
4
+ data.tar.gz: da33fd10aaeda193e7cdd14e73bd288b385ca8e0
5
5
  SHA512:
6
- metadata.gz: 9df486426f658553cd33b7dd12d93684f689908b98eab73e22998da5f362a98d75c540d178110e9f122bf8f6035dc2550c448f840b9f3100bff3604bf568400d
7
- data.tar.gz: db3976453fb9d532accd13698a61e8c78a706f29ede4c3726c44a2bad5d7a926023b24abc6b682413bb744c5475a31c82a1af9bb7dbcf43786e7d500d6023e81
6
+ metadata.gz: e02327b9b03ed0818f04aca9142d4d8009384e854674a7ea093538941a55f8b626f993ba309458b30b297124344f6a2a08419360a69e0123c6f44bf5152e36de
7
+ data.tar.gz: d0d39cbecf6bd53b80a58e5c4cb67e039fa2e29ce984670ae919418611e8db823f89b8308d75390e1aa98bcf8cb9651544c68fef3dab83fbf79282e07e068c94
@@ -1,3 +1,3 @@
1
1
  module PaperclipUtils
2
- VERSION = '1.2.1'
2
+ VERSION = '1.2.2'
3
3
  end
@@ -3,16 +3,14 @@ require 'paperclip_processors/ghostscript.rb'
3
3
 
4
4
  module Paperclip
5
5
  class Utils
6
- def self.get_processors(content_type, to_processors: [:thumbnail], fallback_processors: [], allowed_content_types: ALLOWED_CONTENT_TYPES)
7
- if to_processors
8
- if to_processors.is_a?(Array)
9
- processors = to_processors
10
-
6
+ def self.get_processors(content_type, processors: [:thumbnail], fallback_processors: [], allowed_content_types: ALLOWED_CONTENT_TYPES)
7
+ if processors
8
+ if processors.is_a?(Array)
11
9
  if processors.include?(:thumbnail) && content_type == 'application/pdf' && !processors.include?(:ghostscript)
12
10
  processors.unshift(:ghostscript)
13
11
  end
14
- elsif to_processors.is_a?(Symbol)
15
- processors = [to_processors]
12
+ elsif processors.is_a?(Symbol)
13
+ processors = [processors]
16
14
  else
17
15
  processors = []
18
16
  end
@@ -31,17 +29,17 @@ module Paperclip
31
29
  return (allowed_content_types.include?(content_type) ? processors : fallback_processors)
32
30
  end
33
31
 
34
- def self.get_styles(content_type, to_styles: {preview: "800x600>", thumb: "100x100>"}, fallback_styles: {}, allowed_content_types: ALLOWED_CONTENT_TYPES)
35
- if to_styles
32
+ def self.get_styles(content_type, styles: {preview: "800x600>", thumb: "100x100>"}, fallback_styles: {}, allowed_content_types: ALLOWED_CONTENT_TYPES)
33
+ if styles
36
34
  if ['application/pdf','image/tiff','image/tif','image/x-tiff'].include?(content_type)
37
- to_styles.each do |k,v|
38
- to_styles[k] = [(v.is_a?(String) ? v : v[0]), :jpg]
35
+ styles.each do |k,v|
36
+ styles[k] = [(v.is_a?(String) ? v : v[0]), :jpg]
39
37
  end
40
38
  end
41
39
  else
42
- to_styles = []
40
+ styles = []
43
41
  end
44
- return (allowed_content_types.include?(content_type) ? to_styles : fallback_styles)
42
+ return (allowed_content_types.include?(content_type) ? styles : fallback_styles)
45
43
  end
46
44
 
47
45
  ALLOWED_CONTENT_TYPES = ['application/pdf', 'image/png', 'image/x-png', 'image/gif', 'image/jpeg', 'image/pjpeg', 'image/jpg', 'image/tif', 'image/tiff', 'image/x-tiff']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Weston Ganger