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.
1149 1150 1151 1152 |
# File 'lib/test/unit/assertions.rb', line 1149 def initialize(value, &formatter) @value = value @formatter = formatter end |
Instance Method Details
#inspect ⇒ Object
1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 |
# File 'lib/test/unit/assertions.rb', line 1154 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 |