Class: RailsLiveDashboard::Recorders::Jobs::DiscardRecorder

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_live_dashboard/recorders/jobs/discard_recorder.rb

Instance Method Summary collapse

Constructor Details

#initialize(event) ⇒ DiscardRecorder

Returns a new instance of DiscardRecorder.



5
6
7
8
# File 'lib/rails_live_dashboard/recorders/jobs/discard_recorder.rb', line 5

def initialize(event)
  @event = event
  @job = Job.same(@event.payload[:job].job_id).first
end

Instance Method Details

#executeObject



10
11
12
13
14
15
16
17
# File 'lib/rails_live_dashboard/recorders/jobs/discard_recorder.rb', line 10

def execute
  raise Exceptions::EntryNotFound.new(:job, @event.payload[:job].job_id) if @job.nil?

  build_content
  build_history

  @job.update(content:)
end