Class: Mutool
- Inherits:
-
Object
- Object
- Mutool
- Defined in:
- lib/mutool.rb,
lib/mutool/version.rb
Constant Summary collapse
- VERSION =
'0.1.2'.freeze
Class Attribute Summary collapse
-
.has_mutool ⇒ Object
Returns the value of attribute has_mutool.
-
.mutool_path ⇒ Object
writeonly
Sets the attribute mutool_path.
Class Method Summary collapse
- .clean(input, output, pages = '1-N', ops) ⇒ Object
-
.convert(input, pages = '1-N', ops) ⇒ Object
Reference: mupdf.com/docs/manual-mutool-convert.html.
- .flags(ops = {}) ⇒ Object
- .has_mutool? ⇒ Boolean
- .version ⇒ Object
Class Attribute Details
.has_mutool ⇒ Object
Returns the value of attribute has_mutool.
7 8 9 |
# File 'lib/mutool.rb', line 7 def has_mutool @has_mutool end |
.mutool_path=(value) ⇒ Object
Sets the attribute mutool_path
7 8 9 |
# File 'lib/mutool.rb', line 7 def mutool_path=(value) @mutool_path = value end |
Class Method Details
.clean(input, output, pages = '1-N', ops) ⇒ Object
29 30 31 32 |
# File 'lib/mutool.rb', line 29 def clean(input, output, pages='1-N', ops) raise 'mutool not found' unless has_mutool? run([mutool_path, 'clean', flags(ops), input, output, pages].flatten) end |
.convert(input, pages = '1-N', ops) ⇒ Object
Reference: mupdf.com/docs/manual-mutool-convert.html
23 24 25 26 |
# File 'lib/mutool.rb', line 23 def convert(input, pages='1-N', ops) raise 'mutool not found' unless has_mutool? run([mutool_path, 'convert', flags(ops), input, pages].flatten) end |
.flags(ops = {}) ⇒ Object
13 14 15 |
# File 'lib/mutool.rb', line 13 def flags(ops = {}) ops.map { |key, value| ["-#{key}", value] } end |
.has_mutool? ⇒ Boolean
9 10 11 |
# File 'lib/mutool.rb', line 9 def has_mutool? @has_mutool ||= run([mutool_path]).exitstatus == 1 end |
.version ⇒ Object
17 18 19 20 |
# File 'lib/mutool.rb', line 17 def version raise 'mutool not found' unless has_mutool? @version ||= version_str.gsub("\n", '').split(' ').last end |