Class: Pipeline::Finding
- Inherits:
-
Object
- Object
- Pipeline::Finding
- Defined in:
- lib/pipeline/finding.rb
Instance Attribute Summary collapse
-
#appname ⇒ Object
readonly
Returns the value of attribute appname.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#detail ⇒ Object
readonly
Returns the value of attribute detail.
-
#fingerprint ⇒ Object
readonly
Returns the value of attribute fingerprint.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(appname, description, detail, source, severity, fingerprint) ⇒ Finding
constructor
A new instance of Finding.
- #to_csv ⇒ Object
- #to_json ⇒ Object
- #to_string ⇒ Object
Constructor Details
#initialize(appname, description, detail, source, severity, fingerprint) ⇒ Finding
Returns a new instance of Finding.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/pipeline/finding.rb', line 12 def initialize appname, description, detail, source, severity, fingerprint @appname = appname @timestamp = Time.now @description = description @detail = detail @source = source @stringsrc = source.to_s @severity = severity @fingerprint = fingerprint end |
Instance Attribute Details
#appname ⇒ Object (readonly)
Returns the value of attribute appname.
4 5 6 |
# File 'lib/pipeline/finding.rb', line 4 def appname @appname end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
8 9 10 |
# File 'lib/pipeline/finding.rb', line 8 def description @description end |
#detail ⇒ Object (readonly)
Returns the value of attribute detail.
9 10 11 |
# File 'lib/pipeline/finding.rb', line 9 def detail @detail end |
#fingerprint ⇒ Object (readonly)
Returns the value of attribute fingerprint.
10 11 12 |
# File 'lib/pipeline/finding.rb', line 10 def fingerprint @fingerprint end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
6 7 8 |
# File 'lib/pipeline/finding.rb', line 6 def severity @severity end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
7 8 9 |
# File 'lib/pipeline/finding.rb', line 7 def source @source end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
5 6 7 |
# File 'lib/pipeline/finding.rb', line 5 def @timestamp end |
Instance Method Details
#to_csv ⇒ Object
34 35 36 37 |
# File 'lib/pipeline/finding.rb', line 34 def to_csv s = "#{@appname},#{@description},#{@timestamp},#{@source.to_s},#{@severity},#{@fingerprint},#{@detail}\n" s end |
#to_json ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/pipeline/finding.rb', line 39 def to_json json = { 'appname' => @appname, 'description' => @description, 'fingerprint' => @fingerprint, 'detail' => @detail, 'source' => @source, 'severity' => @severity, 'timestamp' => @timestamp }.to_json json end |
#to_string ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pipeline/finding.rb', line 23 def to_string s = "Finding: #{@appname}" s << "\n\tDescription: #{@description}" s << "\n\tTimestamp: #{@timestamp}" s << "\n\tSource: #{@stringsrc}" s << "\n\tSeverity: #{@severity}" s << "\n\tFingerprint: #{@fingerprint}" s << "\n\tDetail: #{@detail}" s end |