Class: Ichnite::TestLogger
Instance Attribute Summary collapse
-
#events ⇒ Object
readonly
Returns the value of attribute events.
Attributes inherited from Logger
Instance Method Summary collapse
- #emit(data) ⇒ Object
-
#initialize ⇒ TestLogger
constructor
A new instance of TestLogger.
- #output ⇒ Object
- #reset ⇒ Object
Methods inherited from Logger
Constructor Details
#initialize ⇒ TestLogger
Returns a new instance of TestLogger.
8 9 10 11 12 |
# File 'lib/ichnite/testing.rb', line 8 def initialize @events = [] @buffer = StringIO.new super ::Logger.new(@buffer) end |
Instance Attribute Details
#events ⇒ Object (readonly)
Returns the value of attribute events.
6 7 8 |
# File 'lib/ichnite/testing.rb', line 6 def events @events end |
Instance Method Details
#emit(data) ⇒ Object
19 20 21 22 23 |
# File 'lib/ichnite/testing.rb', line 19 def emit(data) event = data.dup @events << [event.delete(:event), event] super end |
#output ⇒ Object
25 26 27 |
# File 'lib/ichnite/testing.rb', line 25 def output @buffer.string end |
#reset ⇒ Object
14 15 16 17 |
# File 'lib/ichnite/testing.rb', line 14 def reset @events = [] @buffer.truncate(0) end |