Class: SeeingIsBelieving::EventStream::Handlers::Debug

Inherits:
Object
  • Object
show all
Defined in:
lib/seeing_is_believing/event_stream/handlers/debug.rb

Overview

Even though the debugger can be disabled, which would push the decision of whether to report or not into the debugger where it belongs, you should still avoid using this class if you don’t need it since it is expensive and there could be tens of millions of events, eg github.com/JoshCheek/seeing_is_believing/issues/12

Instance Method Summary collapse

Constructor Details

#initialize(debugger, handler) ⇒ Debug

Returns a new instance of Debug.



9
10
11
12
13
14
15
16
# File 'lib/seeing_is_believing/event_stream/handlers/debug.rb', line 9

def initialize(debugger, handler)
  @debugger   = debugger
  @handler    = handler
  @seen       = ""
  @line_width = 150 # debugger is basically for me, so giving it a nice wide width
  @name_width = 20
  @attr_width = @line_width - @name_width
end

Instance Method Details

#call(event) ⇒ Object



18
19
20
21
22
# File 'lib/seeing_is_believing/event_stream/handlers/debug.rb', line 18

def call(event)
  observe event
  finish if event.kind_of? Events::Finished
  @handler.call event
end