Class: FLV::Edit::Processor::Reader
- Defined in:
- lib/flvedit/processor/reader.rb
Overview
Reader is a Processor class (see Base) which use options to generate
its sources (instead of the passed source which should be nil)
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #each ⇒ Object
- #each_source ⇒ Object
-
#initialize ⇒ Reader
constructor
A new instance of Reader.
- #rewind_source ⇒ Object
Methods inherited from Base
Constructor Details
#initialize ⇒ Reader
Returns a new instance of Reader.
8 9 10 11 12 13 14 |
# File 'lib/flvedit/processor/reader.rb', line 8 def initialize(*) super raise "Invalid filenames: #{[:files].inspect}" unless [:files].all? raise "Please specify at least one filename" if [:files].empty? raise NotImplemented, "Reader can't have a source (other than options[:files])" if source rewind_source end |
Instance Method Details
#each ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/flvedit/processor/reader.rb', line 22 def each p "Opening #{@sources.first}" FLV::File.open(@sources.shift) do |f| @source = f begin super rescue EOFError p "*** Warning: unexpected EOF for file #{f.path}" end end end |
#each_source ⇒ Object
16 17 18 19 20 |
# File 'lib/flvedit/processor/reader.rb', line 16 def each_source return to_enum(:each_source) unless block_given? rewind_source yield until @sources.empty? end |
#rewind_source ⇒ Object
34 35 36 |
# File 'lib/flvedit/processor/reader.rb', line 34 def rewind_source @sources = [:files].dup end |