Class: DragonflyPdf::Processors::PageThumb
- Inherits:
-
Object
- Object
- DragonflyPdf::Processors::PageThumb
- Defined in:
- lib/dragonfly_pdf/processors/page_thumb.rb
Instance Method Summary collapse
- #call(content, page, geometry = nil, options = {}) ⇒ Object
- #update_url(attrs, _page, _geometry = nil, options = {}) ⇒ Object
Instance Method Details
#call(content, page, geometry = nil, options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/dragonfly_pdf/processors/page_thumb.rb', line 4 def call(content, page, geometry = nil, = {}) raise UnsupportedFormat unless content.ext raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase) = DragonflyPdf.stringify_keys() format = .delete('format') { 'jpg' }.to_s convert(content, page, geometry, format) unless %w[pdf png svg].include?(format) thumb(content, geometry, format, ) end content.['format'] = format content.ext = format content.['mime_type'] = nil # don't need it as we have ext now end |
#update_url(attrs, _page, _geometry = nil, options = {}) ⇒ Object
22 23 24 25 |
# File 'lib/dragonfly_pdf/processors/page_thumb.rb', line 22 def update_url(attrs, _page, _geometry = nil, = {}) = .each_with_object({}) { |(k, v), memo| memo[k.to_s] = v } # stringify keys attrs.ext = .fetch('format', 'jpg').to_s end |