class Watchdocs::Rails::Recordings::Recorder
Attributes
from_specs[R]
output[R]
store[R]
Public Class Methods
new(from_specs: true)
click to toggle source
# File lib/watchdocs/rails/recordings/recorder.rb, line 7 def initialize(from_specs: true) @from_specs = from_specs set_store end
Public Instance Methods
call(new_call)
click to toggle source
# File lib/watchdocs/rails/recordings/recorder.rb, line 12 def call(new_call) record_new(new_call) save_recordings send_recordings if buffer_full? end
Private Instance Methods
buffer_full?()
click to toggle source
# File lib/watchdocs/rails/recordings/recorder.rb, line 52 def buffer_full? current_recordings.count > buffer_size end
buffer_size()
click to toggle source
# File lib/watchdocs/rails/recordings/recorder.rb, line 56 def buffer_size Rails.configuration.buffer_size end
current_recordings()
click to toggle source
# File lib/watchdocs/rails/recordings/recorder.rb, line 28 def current_recordings @current ||= store.read end
record_new(new_call)
click to toggle source
# File lib/watchdocs/rails/recordings/recorder.rb, line 20 def record_new(new_call) @output = if recordings_any? current_recordings << new_call else [new_call] end end
recordings_any?()
click to toggle source
# File lib/watchdocs/rails/recordings/recorder.rb, line 36 def recordings_any? store.exists? end
save_recordings()
click to toggle source
# File lib/watchdocs/rails/recordings/recorder.rb, line 32 def save_recordings store.write(output) end
send_recordings()
click to toggle source
# File lib/watchdocs/rails/recordings/recorder.rb, line 40 def send_recordings Recordings.export(output, from_specs: from_specs) end
set_store()
click to toggle source
# File lib/watchdocs/rails/recordings/recorder.rb, line 44 def set_store @store = if from_specs Rails::Buffer::MemoryBuffer else Rails::Buffer::FileBuffer end end