lib/aviglitch/frames.rb in aviglitch-0.1.0 vs lib/aviglitch/frames.rb in aviglitch-0.1.1

- old
+ new

@@ -6,22 +6,22 @@ # through AviGlitch#frames, for example: # # avi = AviGlitch.new '/path/to/your.avi' # frames = avi.frames # frames.each do |frame| - # ## frame is a reference of a AviGlitch::Frame object + # ## frame is a reference of an AviGlitch::Frame object # frame.data = frame.data.gsub(/\d/, '0') # end # # In the block passed into iteration method, the parameter is a reference # of AviGlitch::Frame object. # class Frames include Enumerable - SAFE_FRAMES_COUNT = 150000 # :nodoc: - @@warn_if_frames_are_too_large = true # :nodoc: + SAFE_FRAMES_COUNT = 150000 #:nodoc: + @@warn_if_frames_are_too_large = true #:nodoc: attr_reader :meta ## # Creates a new AviGlitch::Frames object. @@ -66,11 +66,11 @@ # Returns the number of frames. def size @meta.size end - def frames_data_as_io(io = nil, block = nil) #:nodoc: + def frames_data_as_io io = nil, block = nil #:nodoc: io = Tempfile.new('tmep') if io.nil? @meta = @meta.select do |m| @io.pos = @pos_of_movi + m[:offset] + 8 # 8 for id and size frame = Frame.new(@io.read(m[:size]), m[:id], m[:flag]) block.call(frame) if block # accept the variable block as Proc @@ -299,11 +299,11 @@ ## # Alias for push alias_method :<<, :push ## - # Insert the given Frame objects into the given index. + # Inserts the given Frame objects into the given index. def insert n, *args new_frames = self.slice(0, n) args.each do |f| new_frames.push f end @@ -325,11 +325,11 @@ def == other @meta == other.meta end ## - # Generate new AviGlitch::Base instance using self. + # Generates new AviGlitch::Base instance using self. def to_avi AviGlitch.open @io.path end def get_beginning_and_length *args #:nodoc: @@ -342,10 +342,10 @@ end b = b >= 0 ? b : @meta.size + b [b, l] end - def safe_frames_count? count # :nodoc: + def safe_frames_count? count #:nodoc: r = true if @@warn_if_frames_are_too_large && count >= SAFE_FRAMES_COUNT trap(:INT) do @io.close! exit