class ForemanInventoryUpload::Async::ProgressOutput

Public Class Methods

get(label) click to toggle source
# File lib/foreman_inventory_upload/async/progress_output.rb, line 4
def self.get(label)
  ProgressOutput.new(label, :reader)
end
new(label, mode) click to toggle source
# File lib/foreman_inventory_upload/async/progress_output.rb, line 13
def initialize(label, mode)
  @label = label
  @mode = mode
end
register(label) click to toggle source
# File lib/foreman_inventory_upload/async/progress_output.rb, line 8
def self.register(label)
  TaskOutputLine.where(label: @label).delete_all
  ProgressOutput.new(label, :writer)
end

Public Instance Methods

close() click to toggle source
# File lib/foreman_inventory_upload/async/progress_output.rb, line 26
def close
end
full_output() click to toggle source
# File lib/foreman_inventory_upload/async/progress_output.rb, line 18
def full_output
  TaskOutputLine.where(label: @label).order(:created_at).pluck(:line).join("\n")
end
status() click to toggle source
# File lib/foreman_inventory_upload/async/progress_output.rb, line 29
def status
  TaskOutputStatus.where(label: @label).pluck(:status).first || ''
end
status=(status) click to toggle source
# File lib/foreman_inventory_upload/async/progress_output.rb, line 33
def status=(status)
  TaskOutputStatus.upsert({ label: @label, status: status }, unique_by: :label)
end
write_line(line) click to toggle source
# File lib/foreman_inventory_upload/async/progress_output.rb, line 22
def write_line(line)
  TaskOutputLine.create!(label: @label, line: line)
end