Class: Asciicast

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(terminal_columns, terminal_lines, duration, file_location) ⇒ Asciicast

Returns a new instance of Asciicast.



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

def initialize(terminal_columns, terminal_lines, duration, file_location)
  @terminal_columns = terminal_columns
  @terminal_lines = terminal_lines
  @duration = duration
  @file = File.new(file_location)
  @version = 1
end

Instance Attribute Details

#durationObject (readonly)

Returns the value of attribute duration.



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

def duration
  @duration
end

#fileObject (readonly)

Returns the value of attribute file.



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

def file
  @file
end

#snapshotObject

Returns the value of attribute snapshot.



8
9
10
# File 'lib/asciinema/asciicast.rb', line 8

def snapshot
  @snapshot
end

#snapshot_atObject

Returns the value of attribute snapshot_at.



8
9
10
# File 'lib/asciinema/asciicast.rb', line 8

def snapshot_at
  @snapshot_at
end

#stdout_framesObject

Returns the value of attribute stdout_frames.



8
9
10
# File 'lib/asciinema/asciicast.rb', line 8

def stdout_frames
  @stdout_frames
end

#terminal_columnsObject (readonly)

Returns the value of attribute terminal_columns.



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

def terminal_columns
  @terminal_columns
end

#terminal_linesObject (readonly)

Returns the value of attribute terminal_lines.



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

def terminal_lines
  @terminal_lines
end

#versionObject (readonly)

Returns the value of attribute version.



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

def version
  @version
end

Instance Method Details

#stdoutObject



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

def stdout
  return @stdout if @stdout
  @stdout = Stdout::Buffered.new(get_stdout)
end

#with_terminalObject



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

def with_terminal
  terminal = Terminal.new(terminal_columns, terminal_lines)
  yield(terminal)
ensure
  terminal.release if terminal
end