Sha256: f94ec352f050f1175630b5e871ccfd7b0d1049e4e2e5db17da79ea51edfa9083

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

module FLV
  module Edit  
    module Processor

      # Reader is a Processor class (see Base) which use <tt>options[:files]</tt> to generate
      # its sources (instead of the passed +source+ which should be nil)
      class Reader < Base
        def initialize(*)
          super
          raise "Invalid filenames: #{options[:files].inspect}" unless options[:files].all?
          raise "Please specify at least one filename" if options[:files].empty?
          raise NotImplemented, "Reader can't have a source (other than options[:files])" if source
          rewind_source
        end

        def each_source
          return to_enum(:each_source) unless block_given?
          rewind_source
          yield until @sources.empty?
        end
        
        def each
          p "Opening #{@sources.first}"
          FLV::File.open(@sources.shift) do |f|
            @source = f
            super
          end
        end
        
        def rewind_source
          @sources = options[:files].dup
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
marcandre-flvedit-0.6.3 lib/flvedit/processor/reader.rb
marcandre-flvedit-0.6.4 lib/flvedit/processor/reader.rb
marcandre-flvedit-0.7.0 lib/flvedit/processor/reader.rb
flvedit-0.6.4 lib/flvedit/processor/reader.rb
flvedit-0.7.0 lib/flvedit/processor/reader.rb
flvedit-0.6.3 lib/flvedit/processor/reader.rb