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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ExceptionMarshallingWrapper.



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

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.



5
6
7
# File 'lib/parallel_rspec/client.rb', line 5

def backtrace
  @backtrace
end

#causeObject (readonly)

Returns the value of attribute cause.



5
6
7
# File 'lib/parallel_rspec/client.rb', line 5

def cause
  @cause
end

#class_nameObject (readonly)

Returns the value of attribute class_name.



5
6
7
# File 'lib/parallel_rspec/client.rb', line 5

def class_name
  @class_name
end

#messageObject (readonly)

Returns the value of attribute message.



5
6
7
# File 'lib/parallel_rspec/client.rb', line 5

def message
  @message
end

Instance Method Details

#==(other) ⇒ Object



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

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

#classObject



14
15
16
# File 'lib/parallel_rspec/client.rb', line 14

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

#inspectObject



18
19
20
# File 'lib/parallel_rspec/client.rb', line 18

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