paperclip_utils 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b464cca28bcdb7e338e3509a619538875bf64800
4
- data.tar.gz: 5f3d3912f8de2d97e7a5d27d9e2d3ea3652da952
3
+ metadata.gz: 1a56dbe7fd83b32d54e8e6a1d27c290c18bce57b
4
+ data.tar.gz: d458ec5792f1be88c377c635e91d9555ec1488fb
5
5
  SHA512:
6
- metadata.gz: 83372f0cb5eb6aca65858cbf77953066cd9827c518cd6d4f37284780dd8d49e0180bbe6c4ca41a09cd23af67bc535ddcdf1ae1d6fdc834fa754ba864d9a3b8b5
7
- data.tar.gz: 47b1f673cbe8fbac22ee40b768e3d43fa760a03a660ec296412d6c019631fa661c74fb22786649f4494d536228395dd0efdb6c89006444e1e3f66f60abed2347
6
+ metadata.gz: 93ab00047ac3dfa0c37887325be198c924640037ec221c752e6ab92c5a43000d9a3e7f6657a5841b7fe042ae44329072bd664f50bc1fceb032aa2ec2100c2f9d
7
+ data.tar.gz: 5013432814851cab2c89dde719a355e0155b1a54d683aadb9a22fa6a67a8acbc9978037f840deb6c91a5509e3bb0522f916347f7fdf5521d95e5c40204bc54e3
@@ -1,3 +1,3 @@
1
1
  module PaperclipUtils
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
@@ -17,11 +17,13 @@ module Paperclip
17
17
  return (allowed_content_types.include?(content_type) ? processors : fallback_processors)
18
18
  end
19
19
 
20
- def self.get_styles(content_type, to_styles=nil, fallback_styles={}, allowed_content_types=ALLOWED_CONTENT_TYPES)
20
+ def self.get_styles(content_type, options={to_styles: nil, fallback_styles: {}, allowed_content_types: ALLOWED_CONTENT_TYPES})
21
+ to_styles = options[:to_styles]
22
+
21
23
  if to_styles
22
- if ['application/pdf','image/tiff','image/tif','image/x-tiff'].include?(content_type) && to_styles.any?{|k,v| v.is_a?(String)}
24
+ if ['application/pdf','image/tiff','image/tif','image/x-tiff'].include?(content_type)
23
25
  to_styles.each do |k,v|
24
- to_styles[k] = [v, :jpg]
26
+ to_styles[k] = [(v.is_a?(String) ? v : v[0]), :jpg]
25
27
  end
26
28
  end
27
29
  else
@@ -31,7 +33,7 @@ module Paperclip
31
33
  to_styles = {preview: "800x600>", thumb: "100x100>"}
32
34
  end
33
35
  end
34
- return (allowed_content_types.include?(content_type) ? to_styles : fallback_styles)
36
+ return (options[:allowed_content_types].include?(content_type) ? to_styles : options[:fallback_styles])
35
37
  end
36
38
 
37
39
  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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Weston Ganger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-12 00:00:00.000000000 Z
11
+ date: 2016-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: paperclip