Class: Dependagrab::FileWriter
- Inherits:
-
Object
- Object
- Dependagrab::FileWriter
- Defined in:
- lib/dependagrab/file_writer.rb
Overview
For writing output in to a file in a json format format is aligned to ThreadFix(denimgroup.atlassian.net/wiki/spaces/TDOC/pages/496009270/ThreadFix+File+Format)
Instance Attribute Summary collapse
-
#output_file ⇒ Object
Destination to write file.
Instance Method Summary collapse
-
#initialize(output_file) ⇒ FileWriter
constructor
A new instance of FileWriter.
- #write!(result) ⇒ Object
Constructor Details
#initialize(output_file) ⇒ FileWriter
Returns a new instance of FileWriter.
12 13 14 |
# File 'lib/dependagrab/file_writer.rb', line 12 def initialize(output_file) @output_file = output_file end |
Instance Attribute Details
#output_file ⇒ Object
Destination to write file
10 11 12 |
# File 'lib/dependagrab/file_writer.rb', line 10 def output_file @output_file end |
Instance Method Details
#write!(result) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/dependagrab/file_writer.rb', line 16 def write!(result) scan = result.each do |alert| scan[:findings].append( parse_threadfix_finding(alert) ) end File.open(output_file, "w") do |f| f.write(scan.to_json) end output_file end |