Sha256: 8337b006fd70d3294c617a1578e32c43233b86800c3bb13f322527c0bd65a1c8
Contents?: true
Size: 1.2 KB
Versions: 10
Compression:
Stored size: 1.2 KB
Contents
require 'watchdocs/rails/recordings/recorder' require 'watchdocs/rails/recordings/exporter' module Watchdocs module Rails module Recordings class << self attr_reader :store def record(new_call, from_specs: true) Recorder.new( from_specs: from_specs ).call(new_call) end def clear!(from_specs: true) set_store(from_specs) clear_recordings end def export(recordings = nil, from_specs: true) set_store(from_specs) recordings ||= current_recordings export_recorings(recordings) && clear!(from_specs: from_specs) $stderr.puts "Watchdocs: #{recordings.count} requests exported" end private def current_recordings store.read end def clear_recordings store.delete! end def export_recorings(recordings) Exporter.export(recordings) end def set_store(from_specs) @store = if from_specs Rails::Buffer::MemoryBuffer else Rails::Buffer::FileBuffer end end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems