Class: Sox::Combiner::TmpFileStrategy
- Inherits:
-
BaseStrategy
- Object
- BaseStrategy
- Sox::Combiner::TmpFileStrategy
- Defined in:
- lib/sox/combiner/tmp_file_strategy.rb
Overview
Combines files using temporary files as mediate files.
Constant Summary collapse
- MEDIATE_TYPE =
Type of temporary mediate files:
:raw
- MEDIATE_BITS =
Number of bits for temporary mediate files:
16
- MEDIATE_ENCODING =
Encoding of temporary mediate files:
:signed
Constants included from Shell
Instance Method Summary collapse
-
#write(output_file) ⇒ Object
:nodoc:.
Methods inherited from BaseStrategy
#initialize, #output_effects, #output_options
Methods included from Shell
Constructor Details
This class inherits a constructor from Sox::Combiner::BaseStrategy
Instance Method Details
#write(output_file) ⇒ Object
:nodoc:
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sox/combiner/tmp_file_strategy.rb', line 15 def write(output_file) tmp_files = [] @input_files.each do |input_file| tmp_output_file = gen_tmp_filename tmp_files << tmp_output_file cmd = build_convert_command(input_file, tmp_output_file) sh(cmd) end cmd = build_output_command(tmp_files, output_file) sh(cmd) ensure # Remove temporary files tmp_files.each { |file| FileUtils.rm(file) if ::File.exists?(file) } end |