lib/flv/edit/processor/head.rb in flvedit-0.6.1 vs lib/flv/edit/processor/head.rb in flvedit-0.6.2
- old
+ new
@@ -1,16 +1,20 @@
module FLV
module Edit
module Processor
+
+ # Head is a Processor class (see Base and desc)
class Head < Base
desc "Processes only the first NB tags.", :param => {:class => Integer, :name => "NB"}, :shortcut => "n"
- def on_header(header)
- @count = self.options[:head]
- end
- def on_tag(tag)
- throw :stop if (@count -= 1) < 0
+ def each
+ count = options[:head]
+ super do |chunk|
+ yield chunk
+ break if (count -= 1) < 0 # after the yield because we're not counting the header
+ end
end
+
end
end
end
end
\ No newline at end of file