Class: Logbert::Handlers::ArrayHandler

Inherits:
BaseHandler show all
Defined in:
lib/logbert/handlers/array_handler.rb

Overview

Writes all of the log messages to an array.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseHandler

#formatter, #formatter=, #publish

Constructor Details

#initialize(messages = []) ⇒ ArrayHandler

Returns a new instance of ArrayHandler.



11
12
13
# File 'lib/logbert/handlers/array_handler.rb', line 11

def initialize(messages = [])
  @messages = messages
end

Instance Attribute Details

#messagesObject

Returns the value of attribute messages.



9
10
11
# File 'lib/logbert/handlers/array_handler.rb', line 9

def messages
  @messages
end

Instance Method Details

#emit(output) ⇒ Object



15
16
17
# File 'lib/logbert/handlers/array_handler.rb', line 15

def emit(output)
  @messages << output
end