class TaintedLove::Reporter::FileReporter

Reporter that outputs warnings into a JSON file

Attributes

file_path[R]

Public Class Methods

new(file_path = '/tmp/tainted_love.json') click to toggle source
Calls superclass method TaintedLove::Reporter::Base::new
# File lib/tainted_love/reporter/file_reporter.rb, line 11
def initialize(file_path = '/tmp/tainted_love.json')
  super()
  @file_path = file_path
end

Public Instance Methods

add_warning(warning) click to toggle source
Calls superclass method TaintedLove::Reporter::Base#add_warning
# File lib/tainted_love/reporter/file_reporter.rb, line 16
def add_warning(warning)
  super(warning)

  update_file
end
update_file() click to toggle source
# 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