Решил сделать так:
class MediaFormat attr_accessor :format_line def encode(video) system(command_line(video)) end def command_line(video) format_line.gsub(/%(\w+)/) do |s| method_name = /^%(\w+)$/.match(s).captures0.to_sym encoding.send method_name end end endТеперь, как это выглядит в классе, отвечающем за видюху.
class Video < AR::Base file_column :media def source media.relative_dir end attr_reader :output def encode @m = MediaFormat.new @m.format_line = “ffmpeg -i %source -o %output” @output = “some_file.wmv” @m.encode(self) end endКонечно, MediaFormat-ы задаются статически, output генерится явно не руками, но идея именно такая. В командную строку подставляются названия методов класса Video