paperclip-deflater 0.0.3 → 0.0.4

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: 936994b83a0f58ce48c80d843df09abd36dd8a16
4
- data.tar.gz: fd5e0814a4e0d5e760dc8fe6febffcfc9762e6a6
3
+ metadata.gz: b196a7dc955a47503b40b8cbf9216465c30b7f56
4
+ data.tar.gz: fb8631f41ee2bb5252b2fb82e37137ebb9219bb3
5
5
  SHA512:
6
- metadata.gz: dd26871ffed60ec9eea0c37f904cb07cfd3488bb6bc22e142a29e79620722f20484b4ba40397b3af04d6594ee8f55a3b63677ae26746fe5fcf456d9516721cf8
7
- data.tar.gz: ab704c08c39eef4572b9064ff217043b21630a6a5b7335c1076d9280c9e695e88dc34d465620c9b302df3f6fc4125b32782bc61a07b1dd96df055bf85fa03428
6
+ metadata.gz: 3c0661ca417643b37acf5b66a74947d70ad43ebfa62700716f22515a7db875d6d64329f47abaaa835e6eed2a697747bd7a358e9612a21c2cfb87139003054ab3
7
+ data.tar.gz: e2de539fa82076db90a64c1eefe5949f2f36c84f4c2dafedbbfd0f68806e1ef2c817b19deee6d9b98905d65fe410c69d731aa5bf64cfe284a632b7f6d59115cb
data/README.md CHANGED
@@ -24,15 +24,11 @@ And run `bundle install`.
24
24
  class Something
25
25
  has_attached_file :js,
26
26
  s3_metadata: { content_encoding: 'gzip' },
27
- styles: { gzip: {processors: [:deflater], format: '.gz'} },
27
+ styles: { gzip: {processors: [:gzip], format: '.gz'} },
28
28
  path: "test/:id.:extension:format"
29
29
  end
30
30
  ```
31
31
 
32
- ## Per instance turn-off flag
33
-
34
- If the instance (`xx`) has `xx_no_deflate` method and it returns `true`, you can disable the deflating for the attachment.
35
-
36
32
  ## Contributing
37
33
 
38
34
  1. Fork it
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -8,9 +8,7 @@ module Paperclip
8
8
  @deflate_options = @options[:deflate_options] || {}
9
9
  end
10
10
 
11
- private
12
-
13
- def make_impl
11
+ def make
14
12
  level = @deflate_options[:level]
15
13
  window_bits = @deflate_options[:window_bits]
16
14
  memlevel = @deflate_options[:memlevel]
@@ -13,16 +13,11 @@ module Paperclip
13
13
  end
14
14
 
15
15
  def make
16
- return @file if @attachment.instance_read(:no_deflate) == true
17
- make_impl
16
+ raise NotImplementedError
18
17
  end
19
18
 
20
19
  private
21
20
 
22
- def make_impl
23
- raise NotImplementedError
24
- end
25
-
26
21
  def create_tempfile
27
22
  f = Tempfile.new([@basename, @format ? ".#{@format}" : ''])
28
23
  f.binmode
@@ -8,9 +8,7 @@ module Paperclip
8
8
  @gzip_options = @options[:gzip_options] || {}
9
9
  end
10
10
 
11
- private
12
-
13
- def make_impl
11
+ def make
14
12
  level = @gzip_options[:level]
15
13
  strategy = @gzip_options[:strategy]
16
14
 
@@ -10,19 +10,11 @@ describe Paperclip::Processors::DeflaterBase do
10
10
  allow(attachment).to receive(:instance_read).with(:no_deflate).and_return(no_deflate)
11
11
  end
12
12
  describe "#make" do
13
- context "no_deflate setting is true" do
14
- let(:no_deflate) { true }
15
- it "returns original" do
16
- expect(subject.make).to eq(file)
17
- end
13
+ it "raises an exception" do
14
+ expect{ subject.make }.to raise_error(NotImplementedError)
18
15
  end
19
16
  end
20
17
  describe "private methods" do
21
- describe "#make_impl" do
22
- it "raises an exception" do
23
- expect{ subject.send(:make_impl) }.to raise_error(NotImplementedError)
24
- end
25
- end
26
18
  describe "create_tempfile" do
27
19
  it "returns a tempfile" do
28
20
  f = subject.send(:create_tempfile)
@@ -10,7 +10,7 @@ describe Paperclip::Processors::Deflater do
10
10
  allow(attachment).to receive(:instance_read).with(:no_deflate)
11
11
  end
12
12
  describe "private methods" do
13
- describe "#make_impl" do
13
+ describe "#make" do
14
14
  shared_examples "deflate" do
15
15
  it "deflates the file" do
16
16
  dst = subject.make
@@ -10,7 +10,7 @@ describe Paperclip::Processors::Gzip do
10
10
  allow(attachment).to receive(:instance_read).with(:no_deflate)
11
11
  end
12
12
  describe "private methods" do
13
- describe "#make_impl" do
13
+ describe "#make" do
14
14
  shared_examples "deflate" do
15
15
  it "deflates the file" do
16
16
  dst = subject.make
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip-deflater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daisuke Taniwaki