libis-format 0.9.22 → 0.9.23

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: ed9452c366ebd64b7c1816bd64cdf0db34d8da79
4
- data.tar.gz: db6860f1a4d4448ba6b4355a3b6e84f75238648d
3
+ metadata.gz: 6da0d346cc0447e615991fd72637a58dad86c4fa
4
+ data.tar.gz: dc22da7ae4018757274d2b0531af680438c26498
5
5
  SHA512:
6
- metadata.gz: b50c3e2d3e33fab8274de6717ddde01112a99a7487b282b9a5be3178460532a3ec4bb004d883ec498f3b7315a8df104fe57c1242741049e80097bb2c9324805c
7
- data.tar.gz: 9e73029ba7b308fc34d599ceb85554b2110581959118b15e6329013b501d06a0d02a75aeabbbd73cbd2aa4821c2c61499cc5bbfb2e0cc9de6ce796aa62501de4
6
+ metadata.gz: 2006e623d07fca05eccb2eed9e2223c4c44bd202053231227f26b5564f308c41ff0810796556eeb32e9f3804e5798be93bb123b7f67db02837bf1f2ded468ff9
7
+ data.tar.gz: 29d8ab43eb47664695ab6c705768529ba53eff4df1a06bf86a695f7aabe58c691f3724dd679203aabdf340c3bf576749d45f9d9663e98269acdc4e153a24a2a1
@@ -30,16 +30,19 @@ module Libis
30
30
  @flags.merge!(opts[:flags]) if opts[:flags]
31
31
  end
32
32
 
33
- def self.input_types(_ = nil)
33
+ def self.input_types
34
34
  raise RuntimeError, 'Method #input_types needs to be overridden in converter'
35
35
  end
36
36
 
37
- def self.output_types(_ = nil)
37
+ def self.output_types(_format = nil)
38
38
  raise RuntimeError, 'Method #output_types needs to be overridden in converter'
39
39
  end
40
40
 
41
+ def using_temp(target, &block)
42
+ self.class.using_temp(target, &block)
43
+ end
41
44
 
42
- def using_temp(target)
45
+ def Base.using_temp(target)
43
46
  tempfile = File.join(Dir.tmpdir, Dir::Tmpname.make_tmpname(['convert', File.extname(target)], File.basename(target, '.*').gsub(/\s/, '_')))
44
47
  result = yield tempfile
45
48
  return nil unless result
@@ -14,19 +14,13 @@ module Libis
14
14
 
15
15
  class ImageConverter < Libis::Format::Converter::Base
16
16
 
17
- def self.input_types(_ = nil)
17
+ def self.input_types
18
18
  [:TIFF, :JPG, :PNG, :BMP, :GIF, :JP2, :PDF]
19
19
  end
20
20
 
21
- def self.output_types(input_format = nil)
22
- case input_format
23
- when :JP2
24
- [:JP2]
25
- when *(input_types - [:JP2])
26
- input_types - [:JP2]
27
- else
28
- []
29
- end
21
+ def self.output_types(format = nil)
22
+ return [] unless input_types.include?(format)
23
+ [:TIFF, :JPG, :PNG, :BMP, :GIF, :JP2, :PDF]
30
24
  end
31
25
 
32
26
  def initialize
@@ -10,11 +10,12 @@ module Libis
10
10
 
11
11
  class Jp2Converter < Libis::Format::Converter::Base
12
12
 
13
- def self.input_types(_ = nil)
13
+ def self.input_types
14
14
  [:TIFF, :JPG, :PNG, :BMP, :GIF, :PDF]
15
15
  end
16
16
 
17
- def self.output_types(_ = nil)
17
+ def self.output_types(format = nil)
18
+ return [] unless input_types.include?(format)
18
19
  [:JP2]
19
20
  end
20
21
 
@@ -68,7 +69,7 @@ module Libis
68
69
  @options.each do |key, value|
69
70
  case key
70
71
  when :color_xform
71
- options << '--set-output-j2k-color-xform' << value ? 'YES' : 'NO'
72
+ options << '--set-output-j2k-color-xform' << (value ? 'YES' : 'NO')
72
73
  when :error_resilience
73
74
  options << '--set-output-j2k-error-resilience' << value.to_s
74
75
  when :lossless
@@ -92,9 +93,10 @@ module Libis
92
93
  Libis::Tools::Command.run(
93
94
  Libis::Format::Config[:j2kdriver],
94
95
  '--input-file-name', source,
95
- '--output-file-name', target,
96
96
  '--set-output-type', 'JP2',
97
- *options
97
+ *options,
98
+ '--output-file-name', target,
99
+
98
100
  )
99
101
 
100
102
  target
@@ -11,7 +11,7 @@ module Libis
11
11
 
12
12
  class OfficeConverter < Libis::Format::Converter::Base
13
13
 
14
- def self.input_types(_ = nil)
14
+ def self.input_types
15
15
  [
16
16
  :TXT,
17
17
  :RTF,
@@ -26,7 +26,8 @@ module Libis
26
26
  ]
27
27
  end
28
28
 
29
- def self.output_types(_ = nil)
29
+ def self.output_types(format = nil)
30
+ return [] unless input_types.include?(format)
30
31
  [:PDF]
31
32
  end
32
33
 
@@ -13,11 +13,12 @@ module Libis
13
13
 
14
14
  class PdfConverter < Libis::Format::Converter::Base
15
15
 
16
- def self.input_types(_ = nil)
16
+ def self.input_types
17
17
  [:PDF]
18
18
  end
19
19
 
20
- def self.output_types(_ = nil)
20
+ def self.output_types(format = nil)
21
+ return [] unless input_types.include?(format)
21
22
  [:PDF, :PDFA]
22
23
  end
23
24
 
@@ -1,5 +1,5 @@
1
1
  module Libis
2
2
  module Format
3
- VERSION = '0.9.22'
3
+ VERSION = '0.9.23'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libis-format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.22
4
+ version: 0.9.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kris Dekeyser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-27 00:00:00.000000000 Z
11
+ date: 2016-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler