Class: Pipeline::Tracker
- Inherits:
-
Object
- Object
- Pipeline::Tracker
- Defined in:
- lib/pipeline/tracker.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#findings ⇒ Object
readonly
Returns the value of attribute findings.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
- #error(error) ⇒ Object
-
#initialize(options) ⇒ Tracker
constructor
Pass in the options.
-
#process(event) ⇒ Object
Process events that.
- #report(finding) ⇒ Object
- #to_json ⇒ Object
- #warn(warning) ⇒ Object
Constructor Details
#initialize(options) ⇒ Tracker
Pass in the options. Let the Tracker be the one thing that gets passed around with options and collecting output.
12 13 14 15 16 17 |
# File 'lib/pipeline/tracker.rb', line 12 def initialize @options = @warnings = [] @errors = [] @findings = [] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
6 7 8 |
# File 'lib/pipeline/tracker.rb', line 6 def errors @errors end |
#findings ⇒ Object (readonly)
Returns the value of attribute findings.
7 8 9 |
# File 'lib/pipeline/tracker.rb', line 7 def findings @findings end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/pipeline/tracker.rb', line 4 def @options end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
5 6 7 |
# File 'lib/pipeline/tracker.rb', line 5 def warnings @warnings end |
Instance Method Details
#error(error) ⇒ Object
24 25 26 |
# File 'lib/pipeline/tracker.rb', line 24 def error error @errors << error end |
#process(event) ⇒ Object
Process events that
20 21 22 |
# File 'lib/pipeline/tracker.rb', line 20 def process event end |
#report(finding) ⇒ Object
32 33 34 |
# File 'lib/pipeline/tracker.rb', line 32 def report finding @findings << finding end |
#to_json ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/pipeline/tracker.rb', line 36 def to_json s = "{ \"findings\": [ " @findings.each do |finding| s << finding.to_json s << "," end s = s.slice(0,s.length-1) # One easy way to remove the last , s << "] }" s end |
#warn(warning) ⇒ Object
28 29 30 |
# File 'lib/pipeline/tracker.rb', line 28 def warn warning @warnings << warning end |