Class: RSpec::Risky::Probe::OutputProbe::StreamStats
- Inherits:
-
Object
- Object
- RSpec::Risky::Probe::OutputProbe::StreamStats
- Defined in:
- lib/rspec/risky/probe/output_report.rb
Instance Attribute Summary collapse
-
#byte_count ⇒ Object
readonly
Returns the value of attribute byte_count.
-
#first_location ⇒ Object
readonly
Returns the value of attribute first_location.
-
#first_sample ⇒ Object
readonly
Returns the value of attribute first_sample.
-
#stream_name ⇒ Object
readonly
Returns the value of attribute stream_name.
-
#write_count ⇒ Object
readonly
Returns the value of attribute write_count.
Instance Method Summary collapse
-
#initialize(stream_name) ⇒ StreamStats
constructor
A new instance of StreamStats.
- #record(data, location) ⇒ Object
- #written? ⇒ Boolean
Constructor Details
#initialize(stream_name) ⇒ StreamStats
Returns a new instance of StreamStats.
50 51 52 53 54 55 56 |
# File 'lib/rspec/risky/probe/output_report.rb', line 50 def initialize(stream_name) @stream_name = stream_name @write_count = 0 @byte_count = 0 @first_location = nil @first_sample = nil end |
Instance Attribute Details
#byte_count ⇒ Object (readonly)
Returns the value of attribute byte_count.
48 49 50 |
# File 'lib/rspec/risky/probe/output_report.rb', line 48 def byte_count @byte_count end |
#first_location ⇒ Object (readonly)
Returns the value of attribute first_location.
48 49 50 |
# File 'lib/rspec/risky/probe/output_report.rb', line 48 def first_location @first_location end |
#first_sample ⇒ Object (readonly)
Returns the value of attribute first_sample.
48 49 50 |
# File 'lib/rspec/risky/probe/output_report.rb', line 48 def first_sample @first_sample end |
#stream_name ⇒ Object (readonly)
Returns the value of attribute stream_name.
48 49 50 |
# File 'lib/rspec/risky/probe/output_report.rb', line 48 def stream_name @stream_name end |
#write_count ⇒ Object (readonly)
Returns the value of attribute write_count.
48 49 50 |
# File 'lib/rspec/risky/probe/output_report.rb', line 48 def write_count @write_count end |
Instance Method Details
#record(data, location) ⇒ Object
58 59 60 61 62 63 |
# File 'lib/rspec/risky/probe/output_report.rb', line 58 def record(data, location) @write_count += 1 @byte_count += data.bytesize @first_location ||= location @first_sample ||= data.byteslice(0, 200) end |
#written? ⇒ Boolean
65 66 67 |
# File 'lib/rspec/risky/probe/output_report.rb', line 65 def written? write_count.positive? end |