Class: Yobi::BackupOutcome
- Inherits:
-
Object
- Object
- Yobi::BackupOutcome
- Defined in:
- lib/yobi/repository/backup.rb,
sig/yobi.rbs
Overview
The outcome of one Repository#backup call.
Constant Summary collapse
- COMMAND_OUTPUT_LINE_PATTERN =
/\Asubprocess [^:]+: (.*)/
Instance Attribute Summary collapse
- #output ⇒ Yobi::ResticOutput readonly
Instance Method Summary collapse
-
#command_output {|line| ... } ⇒ Enumerator
The
source: [:stdin_from_command, ...]subprocess's own stderr, if any, de-prefixed. - #errors ⇒ Enumerable<Yobi::BackupError>
-
#initialize(execution) ⇒ BackupOutcome
constructor
A new instance of BackupOutcome.
- #inspect ⇒ String
-
#messages ⇒ Enumerable<Yobi::BackupStatus, Yobi::BackupError, Yobi::BackupVerboseStatus, Yobi::BackupSummary>
Every message from the run, in file order, each wrapped in its own BackupStatus/BackupError/BackupVerboseStatus/BackupSummary.
- #pretty_print(q) ⇒ void
-
#summary ⇒ Yobi::BackupSummary
(also: #report)
Restic's own
"summary"fields.
Constructor Details
#initialize(execution) ⇒ BackupOutcome
Returns a new instance of BackupOutcome.
140 141 142 |
# File 'lib/yobi/repository/backup.rb', line 140 def initialize(execution) @output = execution[:output] end |
Instance Attribute Details
#output ⇒ Yobi::ResticOutput (readonly)
137 138 139 |
# File 'lib/yobi/repository/backup.rb', line 137 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.
161 162 163 164 165 166 167 168 |
# File 'lib/yobi/repository/backup.rb', line 161 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 ⇒ Enumerable<Yobi::BackupError>
145 146 147 |
# File 'lib/yobi/repository/backup.rb', line 145 def errors @errors ||= output.("error") end |
#inspect ⇒ String
466 |
# File 'sig/yobi.rbs', line 466
def inspect: () -> String
|
#messages ⇒ Enumerable<Yobi::BackupStatus, Yobi::BackupError, Yobi::BackupVerboseStatus, Yobi::BackupSummary>
Every message from the run, in file order, each wrapped in its own Yobi::BackupStatus/Yobi::BackupError/Yobi::BackupVerboseStatus/Yobi::BackupSummary.
153 154 155 |
# File 'lib/yobi/repository/backup.rb', line 153 def @messages ||= output. end |
#pretty_print(q) ⇒ void
This method returns an undefined value.
177 178 179 180 181 182 183 184 |
# File 'lib/yobi/repository/backup.rb', line 177 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 ⇒ Yobi::BackupSummary Also known as: report
Returns Restic's own "summary" fields.
171 172 173 |
# File 'lib/yobi/repository/backup.rb', line 171 def summary @summary ||= output.("summary").first || BackupSummary.new({}) end |