Sha256: 76c25aacd910d29f942ab2df9fa4459aafdde7752276d319d1c640e4b1ba67d3

Contents?: true

Size: 771 Bytes

Versions: 2

Compression:

Stored size: 771 Bytes

Contents

module FLV
  module Edit
    module Processor

      # Save is a Processor class (see Base and desc)
      class Save < Base
        desc "Saves the result to PATH", :param => {:class => String, :name => "PATH"}
        
        def each_source
          return to_enum(:each_source) unless block_given?
          @out = FLV::File::open(options[:save] || (h.path+".temp"), "w+b")
          super
        ensure
          @out.close
          finalpath = @out.path.sub(/\.temp$/, '')
          FileUtils.mv(@out.path, finalpath) unless finalpath == @out.path
        end
        
        def each
          return to_enum unless block_given?
          super do |chunk|
            @out << chunk
            yield chunk
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
marcandre-flvedit-0.6.2 lib/flv/edit/processor/save.rb
flvedit-0.6.2 lib/flv/edit/processor/save.rb