Class: Cabriolet::ModificationReport
- Inherits:
-
Object
- Object
- Cabriolet::ModificationReport
- Defined in:
- lib/cabriolet/modifier.rb
Overview
Modification report
Instance Attribute Summary collapse
-
#added ⇒ Object
readonly
Returns the value of attribute added.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#modifications ⇒ Object
readonly
Returns the value of attribute modifications.
-
#original ⇒ Object
readonly
Returns the value of attribute original.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#removed ⇒ Object
readonly
Returns the value of attribute removed.
-
#renamed ⇒ Object
readonly
Returns the value of attribute renamed.
-
#success ⇒ Object
readonly
Returns the value of attribute success.
-
#updated ⇒ Object
readonly
Returns the value of attribute updated.
Instance Method Summary collapse
- #detailed_report ⇒ Object
-
#initialize(success:, original:, output:, modifications: 0, added: 0, updated: 0, removed: 0, renamed: 0, error: nil) ⇒ ModificationReport
constructor
A new instance of ModificationReport.
- #success? ⇒ Boolean
- #summary ⇒ Object
Constructor Details
#initialize(success:, original:, output:, modifications: 0, added: 0, updated: 0, removed: 0, renamed: 0, error: nil) ⇒ ModificationReport
Returns a new instance of ModificationReport.
276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/cabriolet/modifier.rb', line 276 def initialize(success:, original:, output:, modifications: 0, added: 0, updated: 0, removed: 0, renamed: 0, error: nil) @success = success @original = original @output = output @modifications = modifications @added = added @updated = updated @removed = removed @renamed = renamed @error = error end |
Instance Attribute Details
#added ⇒ Object (readonly)
Returns the value of attribute added.
273 274 275 |
# File 'lib/cabriolet/modifier.rb', line 273 def added @added end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
273 274 275 |
# File 'lib/cabriolet/modifier.rb', line 273 def error @error end |
#modifications ⇒ Object (readonly)
Returns the value of attribute modifications.
273 274 275 |
# File 'lib/cabriolet/modifier.rb', line 273 def modifications @modifications end |
#original ⇒ Object (readonly)
Returns the value of attribute original.
273 274 275 |
# File 'lib/cabriolet/modifier.rb', line 273 def original @original end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
273 274 275 |
# File 'lib/cabriolet/modifier.rb', line 273 def output @output end |
#removed ⇒ Object (readonly)
Returns the value of attribute removed.
273 274 275 |
# File 'lib/cabriolet/modifier.rb', line 273 def removed @removed end |
#renamed ⇒ Object (readonly)
Returns the value of attribute renamed.
273 274 275 |
# File 'lib/cabriolet/modifier.rb', line 273 def renamed @renamed end |
#success ⇒ Object (readonly)
Returns the value of attribute success.
273 274 275 |
# File 'lib/cabriolet/modifier.rb', line 273 def success @success end |
#updated ⇒ Object (readonly)
Returns the value of attribute updated.
273 274 275 |
# File 'lib/cabriolet/modifier.rb', line 273 def updated @updated end |
Instance Method Details
#detailed_report ⇒ Object
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/cabriolet/modifier.rb', line 301 def detailed_report report = ["=" * 60] report << "Archive Modification Report" report << ("=" * 60) report << "Original: #{@original}" report << "Output: #{@output}" report << "Status: #{success? ? 'SUCCESS' : 'FAILED'}" report << "" if success? report << "Modifications:" report << " Added: #{@added}" report << " Updated: #{@updated}" report << " Removed: #{@removed}" report << " Renamed: #{@renamed}" report << " Total: #{@modifications}" else report << "Error: #{@error}" end report << "" report << ("=" * 60) report.join("\n") end |
#success? ⇒ Boolean
289 290 291 |
# File 'lib/cabriolet/modifier.rb', line 289 def success? @success end |
#summary ⇒ Object
293 294 295 296 297 298 299 |
# File 'lib/cabriolet/modifier.rb', line 293 def summary if success? "Modified #{@modifications} items: +#{@added} ~#{@updated} -#{@removed} →#{@renamed}" else "Modification failed: #{@error}" end end |