Class: TaintedLove::Reporter::FileReporter
- Defined in:
- lib/tainted_love/reporter/file_reporter.rb
Overview
Reporter that outputs warnings into a JSON file
Instance Attribute Summary collapse
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
Attributes inherited from Base
Instance Method Summary collapse
- #add_warning(warning) ⇒ Object
-
#initialize(file_path = '/tmp/tainted_love.json') ⇒ FileReporter
constructor
A new instance of FileReporter.
- #update_file ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(file_path = '/tmp/tainted_love.json') ⇒ FileReporter
Returns a new instance of FileReporter.
11 12 13 14 |
# File 'lib/tainted_love/reporter/file_reporter.rb', line 11 def initialize(file_path = '/tmp/tainted_love.json') super() @file_path = file_path end |
Instance Attribute Details
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
9 10 11 |
# File 'lib/tainted_love/reporter/file_reporter.rb', line 9 def file_path @file_path end |
Instance Method Details
#add_warning(warning) ⇒ Object
16 17 18 19 20 |
# File 'lib/tainted_love/reporter/file_reporter.rb', line 16 def add_warning(warning) super(warning) update_file end |
#update_file ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/tainted_love/reporter/file_reporter.rb', line 22 def update_file report = { 'warnings': @warnings, 'application_path': Dir.pwd, } File.write(@file_path, report.to_json) end |