Class: Test::Unit::Assertions::AssertionMessage::MaybeContainer
- Inherits:
-
Object
- Object
- Test::Unit::Assertions::AssertionMessage::MaybeContainer
- Defined in:
- lib/test/unit/assertions.rb
Instance Method Summary collapse
-
#initialize(value, &formatter) ⇒ MaybeContainer
constructor
A new instance of MaybeContainer.
- #inspect ⇒ Object
Constructor Details
#initialize(value, &formatter) ⇒ MaybeContainer
Returns a new instance of MaybeContainer.
1686 1687 1688 1689 |
# File 'lib/test/unit/assertions.rb', line 1686 def initialize(value, &formatter) @value = value @formatter = formatter end |
Instance Method Details
#inspect ⇒ Object
1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 |
# File 'lib/test/unit/assertions.rb', line 1691 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 |