paperclip_utils 1.0.2 → 1.0.3

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: c86b81304c42f601e781bc2c0bc07c9baeb22d0f
4
- data.tar.gz: 9dbe6026170048ea023f8f86ab20412b625bee4e
3
+ metadata.gz: 1cf6204f5d5f6e63fa6e25a1c4216d12945b4c42
4
+ data.tar.gz: 70e73994cdd3ee3b3b5631a73987957ba9e4f770
5
5
  SHA512:
6
- metadata.gz: 65e678739fc13b6a946d42fc60e2a15dded7e49392f7d2cdc45db7907f9d68b00fb3205fbed430ebfcd635355b905c40ab78b871c4de354752ebb8607c3fa2cc
7
- data.tar.gz: 8e528f62047b5b62a57619c9e23a013fc99beb1575a5461a583ed5eb50fe2b260c09abd0a8cbf1b1b0b9a871b35552c9a0e801f7541497120d6b58fc0947ed15
6
+ metadata.gz: 74265b0ff12d98695471689d3502068e235b8c98ae18abd2b19fde49f1eb4d9ba170d9bd3bfebe991ef378f55abed002710981a95ff1ba8868912cce57b25e31
7
+ data.tar.gz: c007e4602f38a7d2d2a06c25dbcd059c4e07bf08adec24ddc31fa469732b20c84143cb2d26f110c4b22306f1d9dc6270cf7b804d5644624ead81e40e3a87982f
data/README.md CHANGED
@@ -21,9 +21,9 @@ Paperclip::Utils.get_styles(content_type, styles_if_allowed, fallback_processors
21
21
  # Usage
22
22
  ```ruby
23
23
  class Post < ActiveRecord::Base
24
- has_attachment :file,
25
- styles: lambda{|x| Paperclip::Utils.get_styles(x.instance.file.content_type) },
26
- processors: lambda{|x| Paperclip::Utils.get_processors(x.file.content_type) },
24
+ has_attachment :my_attachment,
25
+ styles: lambda{|x| Paperclip::Utils.get_styles(x.instance.my_attachment.content_type) },
26
+ processors: lambda{|x| Paperclip::Utils.get_processors(x.my_attachment.content_type) },
27
27
  path: "public/system/:class/:attachment/:id_partition/:style/:filename",
28
28
  url: "#{ActionController::Base.relative_url_root}/system/:class/:attachment/:id_partition/:style/:filename"
29
29
  end
@@ -33,11 +33,11 @@ end
33
33
 
34
34
  # Methods
35
35
 
36
- **get_processors** - `Array(optional - default=[:ghostscript,:thumbnail]), Array(optional - default=[]), Array(optional - allowed content types)`
36
+ **get_processors** - `String(file content_type), Array(optional - default=[:ghostscript,:thumbnail]), Array(optional - default=[]), Array(optional - allowed content types)`
37
37
 
38
- **get_styles** - `Hash(optional - default={preview: "800x600>", thumb: "100x100>"}), Hash(optional - default={}), Array(optional - allowed content types)`
38
+ **get_styles** - `String(file content type)Hash(optional - default={preview: "800x600>", thumb: "100x100>"}), Hash(optional - default={}), Array(optional - allowed content types)`
39
39
 
40
- **PAPERCLIP_UTILS_ALLOWED_CONTENT_TYPES** - Default 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']`
40
+ **ALLOWED_CONTENT_TYPES** - Default 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']`
41
41
 
42
42
 
43
43
 
@@ -17,7 +17,7 @@ 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=, fallback_styles={}, allowed_content_types=ALLOWED_CONTENT_TYPES)
20
+ def self.get_styles(content_type, to_styles=nil, fallback_styles={}, allowed_content_types=ALLOWED_CONTENT_TYPES)
21
21
  unless to_styles
22
22
  if ['application/pdf','image/tiff','image/tif','image/x-tiff'].include?(content_type)
23
23
  to_styles = {preview: ["800x600>", :png], thumb: ["100x100>", :png]}
@@ -1,3 +1,3 @@
1
1
  module PaperclipUtils
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
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.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Weston Ganger