Class: ErrorStalker::Backend::InMemory

Inherits:
Base
  • Object
show all
Defined in:
lib/error_stalker/backend/in_memory.rb

Overview

Provides an in-memory backend that stores all exception reports in an array. This is mostly useful for tests, and probably shouldn’t be used in real code.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeInMemory

Create a new instance of this backend, with an empty exception list.



11
12
13
# File 'lib/error_stalker/backend/in_memory.rb', line 11

def initialize
  clear
end

Instance Attribute Details

#exceptionsObject (readonly)

A list of exceptions stored in this backend.



7
8
9
# File 'lib/error_stalker/backend/in_memory.rb', line 7

def exceptions
  @exceptions
end

Instance Method Details

#clearObject

Clears the exception list. Pretty useful in a test setup method!



21
22
23
# File 'lib/error_stalker/backend/in_memory.rb', line 21

def clear
  @exceptions = []
end

#report(exception_report) ⇒ Object

Stores exception_report in the exceptions list.



16
17
18
# File 'lib/error_stalker/backend/in_memory.rb', line 16

def report(exception_report)
  @exceptions << exception_report
end