Exception: ParallelRSpec::ExceptionMarshallingWrapper

Inherits:
Exception
  • Object
show all
Defined in:
lib/parallel_rspec/client.rb

Overview

Some Exception objects contain non-marshallable ivars such as Proc objects. This wrapper represents the bits needed by RSpec’s ExceptionPresenter, and can be dumped and loaded.

Direct Known Subclasses

MultipleExceptionMarshallingWrapper

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(class_name, message, backtrace, cause) ⇒ ExceptionMarshallingWrapper

Returns a new instance of ExceptionMarshallingWrapper.



9
10
11
12
13
14
# File 'lib/parallel_rspec/client.rb', line 9

def initialize(class_name, message, backtrace, cause)
  @class_name = class_name
  @message = message
  @backtrace = backtrace
  @cause = cause
end

Instance Attribute Details

#backtraceObject (readonly)

Returns the value of attribute backtrace.



7
8
9
# File 'lib/parallel_rspec/client.rb', line 7

def backtrace
  @backtrace
end

#causeObject (readonly)

Returns the value of attribute cause.



7
8
9
# File 'lib/parallel_rspec/client.rb', line 7

def cause
  @cause
end

#class_nameObject (readonly)

Returns the value of attribute class_name.



7
8
9
# File 'lib/parallel_rspec/client.rb', line 7

def class_name
  @class_name
end

#messageObject (readonly)

Returns the value of attribute message.



7
8
9
# File 'lib/parallel_rspec/client.rb', line 7

def message
  @message
end

Instance Method Details

#==(other) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/parallel_rspec/client.rb', line 24

def ==(other)
  other.is_a?(ExceptionMarshallingWrapper) &&
    class_name == other.class_name &&
    message == other.message &&
    backtrace == other.backtrace &&
    cause == other.cause
end

#classObject



16
17
18
# File 'lib/parallel_rspec/client.rb', line 16

def class
  eval "class #{@class_name}; end; #{@class_name}"
end

#inspectObject



20
21
22
# File 'lib/parallel_rspec/client.rb', line 20

def inspect
  "#<#{@class_name}: #{@message}>"
end