asciinema.org/app/services/snapshot_creator.rb
2013-08-06 12:50:38 +02:00

14 lines
268 B
Ruby

class SnapshotCreator
def create(width, height, stdout, duration)
terminal = Terminal.new(width, height)
seconds = (duration / 2).to_i
bytes = stdout.bytes_until(seconds)
snapshot = terminal.feed(bytes)
terminal.release
snapshot
end
end