Class: Pipeline::Tracker

Inherits:
Object
  • Object
show all
Defined in:
lib/pipeline/tracker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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
  @options = options
  @warnings = []
  @errors = []
  @findings = []
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



6
7
8
# File 'lib/pipeline/tracker.rb', line 6

def errors
  @errors
end

#findingsObject (readonly)

Returns the value of attribute findings.



7
8
9
# File 'lib/pipeline/tracker.rb', line 7

def findings
  @findings
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/pipeline/tracker.rb', line 4

def options
  @options
end

#warningsObject (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_jsonObject



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