Class: Snapshot

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

Instance Attribute Summary

Attributes inherited from Grid

#height, #lines, #width

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Grid

#as_json, #crop, #diff, #initialize

Constructor Details

This class inherits a constructor from Grid

Class Method Details

.build(data) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/asciinema/snapshot.rb', line 6

def self.build(data)
  data = data.map { |cells|
    cells.map { |cell|
      Cell.new(cell[0], Brush.new(cell[1]))
    }
  }

  new(data)
end

Instance Method Details

#thumbnail(w, h) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/asciinema/snapshot.rb', line 16

def thumbnail(w, h)
  x = 0
  y = height - h - trailing_empty_lines
  y = 0 if y < 0

  crop(x, y, w, h)
end