Class: Test::Unit::Assertions::AssertionMessage::MaybeContainer

Inherits:
Object
  • Object
show all
Defined in:
lib/test/unit/assertions.rb

Instance Method Summary collapse

Constructor Details

#initialize(value, &formatter) ⇒ MaybeContainer

Returns a new instance of MaybeContainer.



1660
1661
1662
1663
# File 'lib/test/unit/assertions.rb', line 1660

def initialize(value, &formatter)
  @value = value
  @formatter = formatter
end

Instance Method Details

#inspectObject



1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
# File 'lib/test/unit/assertions.rb', line 1665

def inspect
  if @value.is_a?(Array)
    values = @value.collect do |value|
      @formatter.call(AssertionMessage.convert(value))
    end
    "[#{values.join(', ')}]"
  else
    @formatter.call(AssertionMessage.convert(@value))
  end
end