Class: TaintedLove::Reporter::Base
- Inherits:
-
Object
- Object
- TaintedLove::Reporter::Base
- Defined in:
- lib/tainted_love/reporter/base.rb
Overview
Base reporter
Direct Known Subclasses
Instance Attribute Summary collapse
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
-
#add_warning(warning) ⇒ Object
Adds a warning to the reporter.
-
#initialize ⇒ Base
constructor
A new instance of Base.
-
#store_warning(warning) ⇒ Object
Stores a warning by its stack trace hash.
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/tainted_love/reporter/base.rb', line 11 def initialize @warnings = Hash.new do |h, k| h[k] = { stack_trace: nil, replacer: nil, inputs: {}, tags: [], message: nil, } end end |
Instance Attribute Details
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
9 10 11 |
# File 'lib/tainted_love/reporter/base.rb', line 9 def warnings @warnings end |
Instance Method Details
#add_warning(warning) ⇒ Object
Adds a warning to the reporter
45 46 47 |
# File 'lib/tainted_love/reporter/base.rb', line 45 def add_warning(warning) store_warning(warning) end |
#store_warning(warning) ⇒ Object
Stores a warning by its stack trace hash
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/tainted_love/reporter/base.rb', line 26 def store_warning(warning) key = warning.stack_trace.trace_hash @warnings[key].merge!( replacer: warning.replacer, stack_trace: warning.stack_trace.lines, tags: warning., message: warning., ) @warnings[key][:inputs][warning.tainted_input] = { reported_at: warning.reported_at, taint_tags: warning.tainted_input..uniq } end |