Class: Test::Unit::Assertions::AssertionMessage::ArrayInspector
- Inherits:
-
Object
- Object
- Test::Unit::Assertions::AssertionMessage::ArrayInspector
- Defined in:
- lib/test/unit/assertions.rb
Class Method Summary collapse
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(array) ⇒ ArrayInspector
constructor
A new instance of ArrayInspector.
- #inspect ⇒ Object
- #pretty_print(q) ⇒ Object
- #pretty_print_cycle(q) ⇒ Object
Constructor Details
#initialize(array) ⇒ ArrayInspector
Returns a new instance of ArrayInspector.
1612 1613 1614 |
# File 'lib/test/unit/assertions.rb', line 1612 def initialize(array) @array = array end |
Class Method Details
.target?(object) ⇒ Boolean
1607 1608 1609 |
# File 'lib/test/unit/assertions.rb', line 1607 def target?(object) object.is_a?(Array) end |
Instance Method Details
#each ⇒ Object
1632 1633 1634 1635 1636 |
# File 'lib/test/unit/assertions.rb', line 1632 def each @array.each do |element| yield(Inspector.new(element)) end end |
#inspect ⇒ Object
1616 1617 1618 |
# File 'lib/test/unit/assertions.rb', line 1616 def inspect @array.inspect end |
#pretty_print(q) ⇒ Object
1620 1621 1622 1623 1624 1625 1626 |
# File 'lib/test/unit/assertions.rb', line 1620 def pretty_print(q) q.group(1, '[', ']') do q.seplist(self) do |v| q.pp(v) end end end |
#pretty_print_cycle(q) ⇒ Object
1628 1629 1630 |
# File 'lib/test/unit/assertions.rb', line 1628 def pretty_print_cycle(q) @array.pretty_print_cycle(q) end |