class TRecs::ZipFileRecorder
Attributes
frames[R]
recorder[RW]
Public Class Methods
new(options={})
click to toggle source
# File lib/trecs/writers/zip_file_writer.rb, line 9 def initialize(options={}) @file_name = options.fetch(:file_name) delete_file end
Public Instance Methods
create_frame()
click to toggle source
# File lib/trecs/writers/zip_file_writer.rb, line 32 def create_frame frames[recorder.current_time] = recorder.current_content end
render()
click to toggle source
# File lib/trecs/writers/zip_file_writer.rb, line 20 def render Zip::File.open(file_name, Zip::File::CREATE) do |trecs_file| frames.each do |timestamp, content| Tempfile.open(timestamp.to_s) do |temp_file| temp_file.write(content) trecs_file.add(timestamp.to_s, temp_file) end end end end
setup()
click to toggle source
this
# File lib/trecs/writers/zip_file_writer.rb, line 16 def setup @frames = {} end
Private Instance Methods
delete_file()
click to toggle source
# File lib/trecs/writers/zip_file_writer.rb, line 39 def delete_file rm file_name if File.exists? file_name end