Class: Burner::Output
- Inherits:
-
Object
- Object
- Burner::Output
- Defined in:
- lib/burner/output.rb
Overview
A Pipeline execution can write main output, which is really an outline to whats happening, step-by-step. This is not meant to replace or be true logging, but serve more as a summary for each of the jobs. Each job can decide what it would like to include in this summary and leverage an instance of this class for inclusion of that information.
Constant Summary collapse
- RULER_LENGTH =
80
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#job_count ⇒ Object
readonly
Returns the value of attribute job_count.
-
#outs ⇒ Object
readonly
Returns the value of attribute outs.
Instance Method Summary collapse
- #complete(time_in_seconds) ⇒ Object
- #detail(message) ⇒ Object
-
#initialize(id: SecureRandom.uuid, outs: [$stdout]) ⇒ Output
constructor
A new instance of Output.
- #ruler ⇒ Object
- #title(message) ⇒ Object
- #write(message) ⇒ Object
Constructor Details
#initialize(id: SecureRandom.uuid, outs: [$stdout]) ⇒ Output
Returns a new instance of Output.
20 21 22 23 24 |
# File 'lib/burner/output.rb', line 20 def initialize(id: SecureRandom.uuid, outs: [$stdout]) @id = id @outs = Array(outs) @job_count = 1 end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
18 19 20 |
# File 'lib/burner/output.rb', line 18 def id @id end |
#job_count ⇒ Object (readonly)
Returns the value of attribute job_count.
18 19 20 |
# File 'lib/burner/output.rb', line 18 def job_count @job_count end |
#outs ⇒ Object (readonly)
Returns the value of attribute outs.
18 19 20 |
# File 'lib/burner/output.rb', line 18 def outs @outs end |
Instance Method Details
#complete(time_in_seconds) ⇒ Object
52 53 54 55 56 |
# File 'lib/burner/output.rb', line 52 def complete(time_in_seconds) detail("Completed in: #{time_in_seconds.round(3)} second(s)") self end |
#detail(message) ⇒ Object
40 41 42 43 44 |
# File 'lib/burner/output.rb', line 40 def detail() write(" - #{}") self end |
#ruler ⇒ Object
26 27 28 29 30 |
# File 'lib/burner/output.rb', line 26 def ruler write('-' * RULER_LENGTH) self end |
#title(message) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/burner/output.rb', line 32 def title() write("[#{job_count}] #{}") @job_count += 1 self end |
#write(message) ⇒ Object
46 47 48 49 50 |
# File 'lib/burner/output.rb', line 46 def write() raw("[#{id} | #{Time.now.utc}] #{}") self end |