Class: FLV::Edit::Processor::Save

Inherits:
Base
  • Object
show all
Defined in:
lib/flvedit/processor/save.rb

Overview

Save is a Processor class (see Base and desc)

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#clone, #each_source, #initialize, #process_all

Constructor Details

This class inherits a constructor from FLV::Edit::Processor::Base

Instance Method Details

#eachObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/flvedit/processor/save.rb', line 9

def each
  return to_enum unless block_given?
  @out = FLV::File::open(options[:save] || (h.path+".temp"), "w+b")
  super do |chunk|
    @out << chunk
    yield chunk
  end
ensure
  @out.close
  finalpath = @out.path.sub(/\.temp$/, '')
  FileUtils.mv(@out.path, finalpath) unless finalpath == @out.path          
end