Class: Nochmal::Output
- Inherits:
-
Object
- Object
- Nochmal::Output
- Defined in:
- lib/nochmal/output.rb
Overview
Handles output for the Reupload Task
Class Method Summary collapse
- .attachment(filename) ⇒ Object
- .model(model, skipping: false) ⇒ Object
- .notes(notes) ⇒ Object
- .print_failure_indicator ⇒ Object
- .print_progress_indicator ⇒ Object
- .print_result_indicator(status) ⇒ Object
- .print_skip_indicator ⇒ Object
- .print_unknown_indicator ⇒ Object
- .reupload(models) ⇒ Object
- .type(type, count, action) ⇒ Object
Class Method Details
.attachment(filename) ⇒ Object
33 34 35 |
# File 'lib/nochmal/output.rb', line 33 def (filename) print (filename) end |
.model(model, skipping: false) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/nochmal/output.rb', line 15 def model(model, skipping: false) if skipping puts "Skipping #{pastel.green(model)}" return true end puts model_header(model) yield puts end |
.notes(notes) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/nochmal/output.rb', line 37 def notes(notes) notes = Array.wrap(notes) return unless notes.any? puts reupload_notes(notes) end |
.print_failure_indicator ⇒ Object
58 59 60 |
# File 'lib/nochmal/output.rb', line 58 def print_failure_indicator print pastel.red("F") end |
.print_progress_indicator ⇒ Object
54 55 56 |
# File 'lib/nochmal/output.rb', line 54 def print_progress_indicator print pastel.green(".") end |
.print_result_indicator(status) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/nochmal/output.rb', line 44 def print_result_indicator(status) case status when :ok then print_progress_indicator when :missing then print_failure_indicator when :skip then print_skip_indicator when :noop then nil else print_unknown_indicator end end |
.print_skip_indicator ⇒ Object
62 63 64 |
# File 'lib/nochmal/output.rb', line 62 def print_skip_indicator print pastel.yellow("*") end |
.print_unknown_indicator ⇒ Object
66 67 68 |
# File 'lib/nochmal/output.rb', line 66 def print_unknown_indicator print pastel.blue("?") end |
.reupload(models) ⇒ Object
9 10 11 12 13 |
# File 'lib/nochmal/output.rb', line 9 def reupload(models) puts reupload_header(models) yield puts end |
.type(type, count, action) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/nochmal/output.rb', line 26 def type(type, count, action) puts type_header(type) print (count, action) yield puts end |