123456789_123456789_123456789_123456789_123456789_

Class: Test::Unit::Assertions::AssertExceptionHelper::WrappedException

Relationships & Source Files
Inherits: Object
Defined in: lib/test/unit/assertions.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(exception) ⇒ WrappedException

[ GitHub ]

  
# File 'lib/test/unit/assertions.rb', line 2107

def initialize(exception)
  @exception = exception
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block)

[ GitHub ]

  
# File 'lib/test/unit/assertions.rb', line 2119

def method_missing(name, *args, &block)
  @exception.__send__(name, *args, &block)
end

Instance Attribute Details

#default_inspect?Boolean (readonly, private)

[ GitHub ]

  
# File 'lib/test/unit/assertions.rb', line 2124

def default_inspect?
  inspect_method = @exception.method(:inspect)
  if inspect_method.respond_to?(:owner) and
      inspect_method.owner == Exception
    true
  else
    default_inspect_method = Exception.instance_method(:inspect)
    default_inspect_method.bind(@exception).call == @exception.inspect
  end
end

#exception (readonly)

[ GitHub ]

  
# File 'lib/test/unit/assertions.rb', line 2106

attr_reader :exception

Instance Method Details

#inspect

[ GitHub ]

  
# File 'lib/test/unit/assertions.rb', line 2111

def inspect
  if default_inspect?
    "#{@exception.class.inspect}(<#{@exception.message}>)"
  else
    @exception.inspect
  end
end