Sha256: b1ae7b1ef23620fe540e08a34d9f829449d715165a58a2f46b5bf6410c4faa69

Contents?: true

Size: 661 Bytes

Versions: 12

Compression:

Stored size: 661 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
          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
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
marcandre-flvedit-0.6.3 lib/flvedit/processor/save.rb
marcandre-flvedit-0.6.4 lib/flvedit/processor/save.rb
marcandre-flvedit-0.7.0 lib/flvedit/processor/save.rb
marcandre-flvedit-0.7.1 lib/flvedit/processor/save.rb
marcandre-flvedit-0.7.2 lib/flvedit/processor/save.rb
marcandre-flvedit-0.7.3 lib/flvedit/processor/save.rb
flvedit-0.7.4 lib/flvedit/processor/save.rb
flvedit-0.7.2 lib/flvedit/processor/save.rb
flvedit-0.7.1 lib/flvedit/processor/save.rb
flvedit-0.6.4 lib/flvedit/processor/save.rb
flvedit-0.7.0 lib/flvedit/processor/save.rb
flvedit-0.6.3 lib/flvedit/processor/save.rb