Class: Poleica::Converters::GraphicsMagick::ThumbnailOptionsGenerator

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/poleica/converters/graphics_magick/thumbnail_options_generator.rb

Overview

Generate options for the GraphicsMagick to_thumbnail

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#bin_path, exec_with_timeout, extract_extension_and_options, fail_if_error, #host_os, init_process_std, #linux?, map_std, #osx?, #underscorize, #windows?

Constructor Details

#initialize(polei, options = {}) ⇒ ThumbnailOptionsGenerator

Returns a new instance of ThumbnailOptionsGenerator.



12
13
14
15
16
# File 'lib/poleica/converters/graphics_magick/thumbnail_options_generator.rb', line 12

def initialize(polei, options = {})
  @polei     = polei
  @options   = default_options.merge(options)
  @current_width, @current_height = identify
end

Instance Attribute Details

#current_heightObject (readonly)

Returns the value of attribute current_height.



9
10
11
# File 'lib/poleica/converters/graphics_magick/thumbnail_options_generator.rb', line 9

def current_height
  @current_height
end

#current_widthObject (readonly)

Returns the value of attribute current_width.



9
10
11
# File 'lib/poleica/converters/graphics_magick/thumbnail_options_generator.rb', line 9

def current_width
  @current_width
end

#optionsObject (readonly)

Returns the value of attribute options.



9
10
11
# File 'lib/poleica/converters/graphics_magick/thumbnail_options_generator.rb', line 9

def options
  @options
end

#output_pathObject (readonly)

Returns the value of attribute output_path.



9
10
11
# File 'lib/poleica/converters/graphics_magick/thumbnail_options_generator.rb', line 9

def output_path
  @output_path
end

#poleiObject (readonly)

Returns the value of attribute polei.



9
10
11
# File 'lib/poleica/converters/graphics_magick/thumbnail_options_generator.rb', line 9

def polei
  @polei
end

Instance Method Details

#generateObject



18
19
20
21
22
23
24
25
26
# File 'lib/poleica/converters/graphics_magick/thumbnail_options_generator.rb', line 18

def generate
  [
    'convert',
    "#{polei.path}[0]",
    orient_options,
    resize_options,
    output_options
  ].flatten
end