Class: Stdout::SingleFile::FrameIterator

Inherits:
Oj::ScHandler
  • Object
show all
Defined in:
lib/asciinema/stdout.rb

Instance Method Summary collapse

Constructor Details

#initialize(callback) ⇒ FrameIterator

Returns a new instance of FrameIterator.



22
23
24
# File 'lib/asciinema/stdout.rb', line 22

def initialize(callback)
  @callback = callback
end

Instance Method Details

#array_append(a, v) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/asciinema/stdout.rb', line 34

def array_append(a, v)
  if a.equal?(@top)
    @callback.call(*v)
  else
    a << v
  end
end

#array_startObject



26
27
28
29
30
31
32
# File 'lib/asciinema/stdout.rb', line 26

def array_start
  if @top # we're already inside top level array
    [] # <- this will hold pair [delay, data]
  else
    @top = []
  end
end