Class: Film

Inherits:
Object
  • Object
show all
Defined in:
lib/asciinema/film.rb

Instance Method Summary collapse

Constructor Details

#initialize(stdout, terminal) ⇒ Film

Returns a new instance of Film.



6
7
8
9
# File 'lib/asciinema/film.rb', line 6

def initialize(stdout, terminal)
  @stdout = stdout
  @terminal = terminal
end

Instance Method Details

#framesObject



19
20
21
22
23
24
25
26
# File 'lib/asciinema/film.rb', line 19

def frames
  frames = stdout.map do |delay, data|
    terminal.feed(data)
    [delay, Frame.new(terminal.snapshot, terminal.cursor)]
  end

  FrameDiffList.new(frames)
end

#snapshot_at(time) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/asciinema/film.rb', line 11

def snapshot_at(time)
  stdout_each_until(time) do |delay, data|
    terminal.feed(data)
  end

  terminal.snapshot
end