class TRecs::TmuxSessionStrategy
Attributes
format[R]
recording[R]
Public Class Methods
new(options={})
click to toggle source
Calls superclass method
TRecs::Strategy::new
# File lib/trecs/strategies/tmux_session_strategy.rb, line 8 def initialize(options={}) super(options) @step = options.fetch(:step) { 100 } @color = options.fetch(:color) { true } set_color_or_bw end
Public Instance Methods
capture_command()
click to toggle source
# File lib/trecs/strategies/tmux_session_strategy.rb, line 28 def capture_command @capture_command ||= set_capture_command end
perform()
click to toggle source
# File lib/trecs/strategies/tmux_session_strategy.rb, line 15 def perform start_recording t = -step while(recording) t += step current_time(t) current_content(get_current_frame) current_format(format) save_frame sleep(step/1000.0) end end
stop()
click to toggle source
# File lib/trecs/strategies/tmux_session_strategy.rb, line 32 def stop @recording = false end
Private Instance Methods
get_current_frame()
click to toggle source
# File lib/trecs/strategies/tmux_session_strategy.rb, line 57 def get_current_frame system *capture_command IO.popen(%W[tmux show-buffer]).read end
set_capture_command()
click to toggle source
# File lib/trecs/strategies/tmux_session_strategy.rb, line 51 def set_capture_command capture_command = %W[tmux capture-pane] capture_command << @color if @color capture_command end
set_color_or_bw()
click to toggle source
# File lib/trecs/strategies/tmux_session_strategy.rb, line 41 def set_color_or_bw if @color @color = "-e" @format = "ansi" else @color = "-C" @format = "raw" end end
start_recording()
click to toggle source
# File lib/trecs/strategies/tmux_session_strategy.rb, line 37 def start_recording @recording = true end