Class: BrokenRecord::JobResult

Inherits:
Object
  • Object
show all
Defined in:
lib/broken_record/job_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job) ⇒ JobResult

Returns a new instance of JobResult.



5
6
7
8
# File 'lib/broken_record/job_result.rb', line 5

def initialize(job)
  @job = job
  @errors = []
end

Instance Attribute Details

#end_timeObject (readonly)

Returns the value of attribute end_time.



3
4
5
# File 'lib/broken_record/job_result.rb', line 3

def end_time
  @end_time
end

#errorsObject (readonly)

Returns the value of attribute errors.



3
4
5
# File 'lib/broken_record/job_result.rb', line 3

def errors
  @errors
end

#jobObject (readonly)

Returns the value of attribute job.



3
4
5
# File 'lib/broken_record/job_result.rb', line 3

def job
  @job
end

#start_timeObject (readonly)

Returns the value of attribute start_time.



3
4
5
# File 'lib/broken_record/job_result.rb', line 3

def start_time
  @start_time
end

Instance Method Details

#add_error(error) ⇒ Object



18
19
20
# File 'lib/broken_record/job_result.rb', line 18

def add_error(error)
  @errors << "#{error.red}\n"
end

#start_timerObject



10
11
12
# File 'lib/broken_record/job_result.rb', line 10

def start_timer
  @start_time = Time.now
end

#stop_timerObject



14
15
16
# File 'lib/broken_record/job_result.rb', line 14

def stop_timer
  @end_time = Time.now
end