Class: CarrierWave::Video::Thumbnailer::Options

Inherits:
Hash
  • Object
show all
Defined in:
lib/carrierwave/video/thumbnailer/ffmpegthumbnailer/options.rb

Overview

Options to be be converted to CLI parameters

Constant Summary collapse

BOOLEAN =
[
  :square,
  :strip,
  :workaround
]

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Options

Returns a new instance of Options.



14
15
16
# File 'lib/carrierwave/video/thumbnailer/ffmpegthumbnailer/options.rb', line 14

def initialize opts
  opts.each { |k, v| self[k] = v}
end

Instance Method Details

#to_cliObject



18
19
20
21
22
23
24
25
26
# File 'lib/carrierwave/video/thumbnailer/ffmpegthumbnailer/options.rb', line 18

def to_cli
  self.map do |k, v|
    if BOOLEAN.include? k
      cli_key k if v
    else
      "#{cli_key k} #{cli_val v}"
    end
  end.join(' ')
end