Module: Yobi::BackupMessageWrapper

Defined in:
lib/yobi/repository/backup.rb,
sig/yobi.rbs

Overview

Classifies a raw backup message Hash by its own message_type, wrapping it in the matching typed class. Used both by Repository#backup (as the ResticOutput transform: for a live streaming run) and by BackupOutcome's own post-hoc accessors.

Class Method Summary collapse

Class Method Details

.call(raw) ⇒ Yobi::BackupStatus, ...

Returns the raw Hash itself for a message_type this version of Yobi doesn't recognize.

Parameters:

  • raw (Hash)

Returns:



116
117
118
119
120
121
122
123
124
# File 'lib/yobi/repository/backup.rb', line 116

def self.call(raw)
  case raw["message_type"]
  when "status" then BackupStatus.new(raw)
  when "error" then BackupError.new(raw)
  when "verbose_status" then BackupVerboseStatus.new(raw)
  when "summary" then BackupSummary.new(raw)
  else raw
  end
end