Class: Yobi::BackupOutcome
- Inherits:
-
Object
- Object
- Yobi::BackupOutcome
- Defined in:
- lib/yobi/repository/backup.rb,
sig/yobi.rbs
Overview
The outcome of one Yobi::Repository#backup call.
Constant Summary collapse
- COMMAND_OUTPUT_LINE_PATTERN =
:nodoc:
/\Asubprocess [^:]+: (.*)/
Instance Attribute Summary collapse
-
#output ⇒ ResticOutput
readonly
The Yobi::ResticOutput backing this outcome.
Instance Method Summary collapse
-
#command_output {|line| ... } ⇒ Object
The
source: [:stdin_from_command, ...]subprocess's own stderr, if any, de-prefixed. -
#errors ⇒ ResticOutput::LazyList[BackupError]
Every Yobi::BackupError message from the run.
-
#initialize(execution) ⇒ BackupOutcome
constructor
:nodoc:.
- #inspect ⇒ String
-
#messages ⇒ ResticOutput::LazyList[BackupStatus | BackupError | BackupVerboseStatus | BackupSummary | Hash[String, untyped]]
Every message from the run, in file order, each wrapped in its own Yobi::BackupStatus / Yobi::BackupError / Yobi::BackupVerboseStatus / Yobi::BackupSummary.
- #pretty_print(q) ⇒ Object
-
#summary ⇒ BackupSummary
(also: #report)
The Yobi::BackupSummary of Restic's own
"summary"fields.
Constructor Details
#initialize(execution) ⇒ BackupOutcome
:nodoc:
134 135 136 |
# File 'lib/yobi/repository/backup.rb', line 134 def initialize(execution) # :nodoc: @output = execution[:output] end |
Instance Attribute Details
#output ⇒ ResticOutput (readonly)
The Yobi::ResticOutput backing this outcome.
132 133 134 |
# File 'lib/yobi/repository/backup.rb', line 132 def output @output end |
Instance Method Details
#command_output ⇒ void #command_output ⇒ Enumerator[String, void]
The source: [:stdin_from_command, ...] subprocess's own stderr, if
any, de-prefixed.
152 153 154 155 156 157 158 159 |
# File 'lib/yobi/repository/backup.rb', line 152 def command_output return enum_for(:command_output) unless block_given? output.stderr_lines.each do |line| match = COMMAND_OUTPUT_LINE_PATTERN.match(line) yield match[1] if match end end |
#errors ⇒ ResticOutput::LazyList[BackupError]
Every Yobi::BackupError message from the run.
139 140 141 |
# File 'lib/yobi/repository/backup.rb', line 139 def errors @errors ||= output.("error") end |
#inspect ⇒ String
466 |
# File 'sig/yobi.rbs', line 466
def inspect: () -> String
|
#messages ⇒ ResticOutput::LazyList[BackupStatus | BackupError | BackupVerboseStatus | BackupSummary | Hash[String, untyped]]
Every message from the run, in file order, each wrapped in its own Yobi::BackupStatus / Yobi::BackupError / Yobi::BackupVerboseStatus / Yobi::BackupSummary.
146 147 148 |
# File 'lib/yobi/repository/backup.rb', line 146 def @messages ||= output. end |
#pretty_print(q) ⇒ Object
167 168 169 170 171 172 173 174 |
# File 'lib/yobi/repository/backup.rb', line 167 def pretty_print(q) q.object_group(self) do q.breakable q.text("(has errors)") if errors.any? q.breakable q.pp summary end end |
#summary ⇒ BackupSummary Also known as: report
The Yobi::BackupSummary of Restic's own "summary" fields.
162 163 164 |
# File 'lib/yobi/repository/backup.rb', line 162 def summary @summary ||= output.("summary").first || BackupSummary.new({}) end |