Class: Thumbnailer::Maker

Inherits:
Object
  • Object
show all
Defined in:
lib/thumbnailer.rb

Instance Method Summary collapse

Constructor Details

#initialize(file_path, mimetype, params = {}) ⇒ Maker

Returns a new instance of Maker.



14
15
16
17
18
19
20
21
# File 'lib/thumbnailer.rb', line 14

def initialize(file_path, mimetype, params = {})
  params = {width: 181, height: 256, string: false}.merge params
  @file_path = file_path
  @mimetype = mimetype
  @width = params[:width]
  @height = params[:height]
  @return_string = params[:string]
end

Instance Method Details

#thumbnailObject



23
24
25
26
# File 'lib/thumbnailer.rb', line 23

def thumbnail
  return odt_thumbnail if @mimetype =~ /opendocument.text/
  return pdf_thumbnail if @mimetype =~ /pdf/
end