Class: Cabriolet::SalvageReport
- Inherits:
-
Object
- Object
- Cabriolet::SalvageReport
- Defined in:
- lib/cabriolet/repairer.rb
Overview
Salvage report
Instance Attribute Summary collapse
-
#output_dir ⇒ Object
readonly
Returns the value of attribute output_dir.
-
#salvaged_files ⇒ Object
readonly
Returns the value of attribute salvaged_files.
-
#stats ⇒ Object
readonly
Returns the value of attribute stats.
Instance Method Summary collapse
- #detailed_report ⇒ Object
-
#initialize(output_dir:, stats:, salvaged_files:) ⇒ SalvageReport
constructor
A new instance of SalvageReport.
- #summary ⇒ Object
Constructor Details
#initialize(output_dir:, stats:, salvaged_files:) ⇒ SalvageReport
257 258 259 260 261 |
# File 'lib/cabriolet/repairer.rb', line 257 def initialize(output_dir:, stats:, salvaged_files:) @output_dir = output_dir @stats = stats @salvaged_files = salvaged_files end |
Instance Attribute Details
#output_dir ⇒ Object (readonly)
Returns the value of attribute output_dir.
255 256 257 |
# File 'lib/cabriolet/repairer.rb', line 255 def output_dir @output_dir end |
#salvaged_files ⇒ Object (readonly)
Returns the value of attribute salvaged_files.
255 256 257 |
# File 'lib/cabriolet/repairer.rb', line 255 def salvaged_files @salvaged_files end |
#stats ⇒ Object (readonly)
Returns the value of attribute stats.
255 256 257 |
# File 'lib/cabriolet/repairer.rb', line 255 def stats @stats end |
Instance Method Details
#detailed_report ⇒ Object
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/cabriolet/repairer.rb', line 267 def detailed_report report = ["=" * 60] report << "Salvage Operation Report" report << ("=" * 60) report << "Output Directory: #{@output_dir}" report << "" report << "Statistics:" report << " Salvaged: #{@stats[:recovered]}" report << " Failed: #{@stats[:failed]}" report << "" if @salvaged_files.any? report << "Salvaged Files:" @salvaged_files.each { |f| report << " - #{f}" } report << "" end report << ("=" * 60) report.join("\n") end |
#summary ⇒ Object
263 264 265 |
# File 'lib/cabriolet/repairer.rb', line 263 def summary "Salvaged #{@stats[:recovered]} files to #{@output_dir}, #{@stats[:failed]} failed" end |