Class: RSpec::Risky::Probe::OutputProbe::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/risky/probe/output_report.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeReport

Returns a new instance of Report.



10
11
12
13
14
15
16
# File 'lib/rspec/risky/probe/output_report.rb', line 10

def initialize
  @streams = {
    logger: StreamStats.new(:logger),
    stdout: StreamStats.new(:stdout),
    stderr: StreamStats.new(:stderr)
  }
end

Instance Attribute Details

#streamsObject (readonly)

Returns the value of attribute streams.



8
9
10
# File 'lib/rspec/risky/probe/output_report.rb', line 8

def streams
  @streams
end

Instance Method Details

#record(stream_name, data, locations) ⇒ Object



18
19
20
# File 'lib/rspec/risky/probe/output_report.rb', line 18

def record(stream_name, data, locations)
  streams.fetch(stream_name).record(data.to_s, first_application_location(locations))
end

#writes_for(rule_config) ⇒ Object



22
23
24
25
26
# File 'lib/rspec/risky/probe/output_report.rb', line 22

def writes_for(rule_config)
  streams.select do |stream_name, stats|
    captured_stream?(rule_config, stream_name) && stats.written?
  end
end