Class: Archsight::Import::ConcurrentProgress::SlotProgress

Inherits:
Object
  • Object
show all
Defined in:
lib/archsight/import/concurrent_progress.rb

Overview

Individual slot progress reporter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent, slot_id, context) ⇒ SlotProgress

Returns a new instance of SlotProgress.



314
315
316
317
318
# File 'lib/archsight/import/concurrent_progress.rb', line 314

def initialize(parent, slot_id, context)
  @parent = parent
  @slot_id = slot_id
  @context = context
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



312
313
314
# File 'lib/archsight/import/concurrent_progress.rb', line 312

def context
  @context
end

#slot_idObject (readonly)

Returns the value of attribute slot_id.



311
312
313
# File 'lib/archsight/import/concurrent_progress.rb', line 311

def slot_id
  @slot_id
end

Instance Method Details

#complete(message = nil) ⇒ Object



324
325
326
# File 'lib/archsight/import/concurrent_progress.rb', line 324

def complete(message = nil)
  @parent.complete_slot(@slot_id, @context, message)
end

#error(message) ⇒ Object



328
329
330
# File 'lib/archsight/import/concurrent_progress.rb', line 328

def error(message)
  @parent.error_slot(@slot_id, @context, message)
end

#releaseObject



337
338
339
# File 'lib/archsight/import/concurrent_progress.rb', line 337

def release
  @parent.release_slot(@slot_id)
end

#update(message, current: nil, total: nil) ⇒ Object



320
321
322
# File 'lib/archsight/import/concurrent_progress.rb', line 320

def update(message, current: nil, total: nil)
  @parent.update_slot(@slot_id, @context, message, current: current, total: total)
end

#warn(message) ⇒ Object



332
333
334
335
# File 'lib/archsight/import/concurrent_progress.rb', line 332

def warn(message)
  # Warnings are shown inline with the current context (yellow in TTY mode)
  @parent.update_slot(@slot_id, @context, "Warning: #{message}", color: COLORS[:yellow])
end