Class: Conduit::Inspector
- Inherits:
-
Object
- Object
- Conduit::Inspector
- Defined in:
- lib/conduit/inspector.rb
Overview
Instance Attribute Summary collapse
-
#counts ⇒ Object
readonly
Returns the value of attribute counts.
Class Method Summary collapse
Instance Method Summary collapse
- #attach ⇒ Object
-
#initialize(stream, io:) ⇒ Inspector
constructor
A new instance of Inspector.
-
#summary ⇒ Object
Print a one-line summary of everything seen so far.
Constructor Details
#initialize(stream, io:) ⇒ Inspector
Returns a new instance of Inspector.
18 19 20 21 22 |
# File 'lib/conduit/inspector.rb', line 18 def initialize(stream, io:) @stream = stream @io = io @counts = Hash.new(0) end |
Instance Attribute Details
#counts ⇒ Object (readonly)
Returns the value of attribute counts.
16 17 18 |
# File 'lib/conduit/inspector.rb', line 16 def counts @counts end |
Class Method Details
.attach(stream, io: $stdout) ⇒ Object
12 13 14 |
# File 'lib/conduit/inspector.rb', line 12 def self.attach(stream, io: $stdout) new(stream, io: io).attach end |
Instance Method Details
#attach ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/conduit/inspector.rb', line 24 def attach log_chunks log_frames log_fields log_pings log_events log_parsed log_errors self end |
#summary ⇒ Object
Print a one-line summary of everything seen so far.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/conduit/inspector.rb', line 36 def summary @io.puts( "[SUMMARY] " \ "chunks=#{@counts[:chunk]} " \ "frames=#{@counts[:frame]} " \ "events=#{@counts[:event]} " \ "parsed=#{@counts[:parsed]} " \ "pings=#{@counts[:ping]} " \ "fields=#{@counts[:field]} " \ "errors=#{@counts[:error]} " \ "last_event_id=#{@stream.last_event_id.inspect} " \ "retry_ms=#{@stream.retry_ms.inspect}" ) end |