class Miniatura::Options

Constants

CLI_KEY

Options class to add various options to the ffmpeg command generated.

Public Class Methods

new(options) click to toggle source
# File lib/miniatura/options.rb, line 12
def initialize(options)
  @options = options
end

Public Instance Methods

file_extension(value) click to toggle source
# File lib/miniatura/options.rb, line 22
def file_extension(value)
  case value
    when 'jpeg'
      '-c mjpeg'
    when 'png'
      '-c png'
    else
      ''
  end
end
method_missing(name, *args) click to toggle source
# File lib/miniatura/options.rb, line 46
def method_missing(name, *args)
  "#{CLI_KEY[name]} #{args[0]}" if CLI_KEY.has_key? name
end
rotate(value) click to toggle source
# File lib/miniatura/options.rb, line 33
def rotate(value)
  case value
    when 90
      '-vf transpose=1'
    when 180
      '-vf hflip '
    when 270
      '-vf transpose=2'
    else
      ''
  end
end
to_options() click to toggle source
# File lib/miniatura/options.rb, line 16
def to_options
  result = @options.map { |k, v| send(k.to_s, v) }
  result << '-vframes 1'
  result.join(' ')
end