Class: DocverterServer::Conversion
- Inherits:
-
Runner::Base
- Object
- Runner::Base
- DocverterServer::Conversion
- Defined in:
- lib/docverter-server/conversion.rb
Instance Attribute Summary
Attributes inherited from Runner::Base
#directory, #input_filename, #options
Instance Method Summary collapse
Methods inherited from Runner::Base
#generate_output_filename, #initialize, #run_command, #with_manifest
Constructor Details
This class inherits a constructor from DocverterServer::Runner::Base
Instance Method Details
#output_extension ⇒ Object
34 35 36 |
# File 'lib/docverter-server/conversion.rb', line 34 def output_extension DocverterServer::ConversionTypes.extension(@manifest.pdf ? 'pdf' : @manifest['to']) end |
#output_mime_type ⇒ Object
30 31 32 |
# File 'lib/docverter-server/conversion.rb', line 30 def output_mime_type DocverterServer::ConversionTypes.mime_type(@manifest.pdf ? 'pdf' : @manifest['to']) end |
#run ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/docverter-server/conversion.rb', line 3 def run with_manifest do |manifest| manifest.validate!(directory) if manifest['to'] == 'pdf' manifest['to'] = 'html' manifest.write('manifest.yml') if manifest['from'] != 'html' @html_filename = DocverterServer::Runner::Pandoc.new(directory).run else @html_filename = manifest['input_files'][0] end @output_filename = DocverterServer::Runner::PDF.new(directory, @html_filename).run elsif manifest['to'] == 'mobi' manifest['to'] = 'epub' manifest.write('manifest.yml') epub = DocverterServer::Runner::Pandoc.new('.').run @output_filename = DocverterServer::Runner::Calibre.new(directory, epub).run else @output_filename = DocverterServer::Runner::Pandoc.new(directory).run end @output_filename end end |