Class: Brute::Events::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/brute/events/handler.rb

Overview

Stackable event handler base class. Subclasses override the append method, do their thing, then call super (or don’t, to swallow the event).

Direct Known Subclasses

PrefixedTerminalOutput, TerminalOutput

Instance Method Summary collapse

Constructor Details

#initialize(inner) ⇒ Handler

Returns a new instance of Handler.



13
14
15
# File 'lib/brute/events/handler.rb', line 13

def initialize(inner)
  @inner = inner
end

Instance Method Details

#<<(event) ⇒ Object

Default: pass through. Subclasses override this method, do their thing, then call super (or don’t, to swallow the event).



19
20
21
22
23
# File 'lib/brute/events/handler.rb', line 19

def <<(event)
  tap do
    @inner << event if @inner
  end
end