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 ⇒ FileReporter
constructor
A new instance of FileReporter.
- #update_file ⇒ Object
Methods inherited from Base
Constructor Details
#initialize ⇒ FileReporter
Returns a new instance of FileReporter.
11 12 13 14 15 |
# File 'lib/tainted_love/reporter/file_reporter.rb', line 11 def initialize super @file_path = '/tmp/tainted_love.json' 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
17 18 19 20 21 |
# File 'lib/tainted_love/reporter/file_reporter.rb', line 17 def add_warning(warning) super(warning) update_file end |
#update_file ⇒ Object
23 24 25 |
# File 'lib/tainted_love/reporter/file_reporter.rb', line 23 def update_file File.write(@file_path, @warnings.to_json) end |