Class: FastForward::Builder
- Inherits:
-
Object
- Object
- FastForward::Builder
- Defined in:
- lib/fastforward/builder.rb
Instance Method Summary collapse
- #command ⇒ Object
-
#initialize {|_self| ... } ⇒ Builder
constructor
A new instance of Builder.
- #input(filename, &block) ⇒ Object
- #output(filename, &block) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Builder
Returns a new instance of Builder.
3 4 5 6 7 8 9 |
# File 'lib/fastforward/builder.rb', line 3 def initialize @global_options = [] @inputs = [] @outputs = [] yield(self) if block_given? end |
Instance Method Details
#command ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fastforward/builder.rb', line 19 def command cmd = Sh::Cmd.new("ffmpeg") do |c| @inputs.each do |input| input..each do |option| c.opt(option.name).arg(option.value) end c.opt("-i").arg(input.filename) end @outputs.each do |output| output..each do |option| c.opt(option.name).arg(option.value) end c.arg(output.filename) end end end |
#input(filename, &block) ⇒ Object
11 12 13 |
# File 'lib/fastforward/builder.rb', line 11 def input(filename, &block) @inputs.push Input.new(filename, &block) end |
#output(filename, &block) ⇒ Object
15 16 17 |
# File 'lib/fastforward/builder.rb', line 15 def output(filename, &block) @outputs.push Output.new(filename, &block) end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/fastforward/builder.rb', line 37 def to_s command.to_s end |