Class: DocPDF::Converter
- Inherits:
-
Object
- Object
- DocPDF::Converter
- Defined in:
- lib/docpdf/converter.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(source = nil, **options) ⇒ Converter
constructor
A new instance of Converter.
Constructor Details
#initialize(source = nil, **options) ⇒ Converter
Returns a new instance of Converter.
9 10 11 |
# File 'lib/docpdf/converter.rb', line 9 def initialize(source = nil, **) @input = InputNormalizer.new(source, **.slice(:io, :data, :filename, :mime_type)) end |
Class Method Details
.call(source = nil, **options) ⇒ Object
4 5 6 |
# File 'lib/docpdf/converter.rb', line 4 def call(source = nil, **) new(source, **).call end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 |
# File 'lib/docpdf/converter.rb', line 13 def call data = ConverterResolver.resolve(@input.mime_type).convert(@input.data, @input.source_filename || @input.filename) filename = build_filename(@input.filename) Result.new(data: data, filename: filename) end |