asciinema.org/app/models/frame_diff_list.rb
2013-09-10 21:29:17 +02:00

25 lines
350 B
Ruby

class FrameDiffList
include Enumerable
delegate :each, :to => :frame_diffs
def initialize(frames)
@frames = frames
end
private
attr_reader :frames
def frame_diffs
previous_frame = nil
frames.map { |delay, frame|
diff = frame.diff(previous_frame)
previous_frame = frame
[delay, diff]
}
end
end