module Recorder::Tape::Record
Public Instance Methods
record(params, options = {})
click to toggle source
# File lib/recorder/tape/record.rb, line 6 def record(params, options = {}) return if Recorder.store.recorder_disabled? params = params_for(params) if async?(options) record_async(params, options) else Recorder::Revision.create(params) end end
Private Instance Methods
async?(options)
click to toggle source
# File lib/recorder/tape/record.rb, line 27 def async?(options) options[:async].nil? ? Recorder.config.async : options[:async] end
params_for(params)
click to toggle source
# File lib/recorder/tape/record.rb, line 20 def params_for(params) Recorder.store.params.merge({ action_date: Date.today, **params }) end
record_async(params, options)
click to toggle source
# File lib/recorder/tape/record.rb, line 31 def record_async(params, options) Recorder::Sidekiq::RevisionsWorker.perform_in( options[:delay] || 2.seconds, params ) end