Class: Test::Unit::Assertions::AssertionMessage::ArrayInspector

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(array, inspected_objects) ⇒ ArrayInspector

Returns a new instance of ArrayInspector.



1745
1746
1747
1748
1749
1750
# File 'lib/test/unit/assertions.rb', line 1745

def initialize(array, inspected_objects)
  @inspected_objects = inspected_objects
  @array = array.collect do |element|
    Inspector.cached_new(element, @inspected_objects)
  end
end

Class Method Details

.target?(object) ⇒ Boolean

Returns:

  • (Boolean)


1740
1741
1742
# File 'lib/test/unit/assertions.rb', line 1740

def target?(object)
  object.is_a?(Array)
end

Instance Method Details

#each(&block) ⇒ Object



1768
1769
1770
# File 'lib/test/unit/assertions.rb', line 1768

def each(&block)
  @array.each(&block)
end

#inspectObject



1752
1753
1754
# File 'lib/test/unit/assertions.rb', line 1752

def inspect
  @array.inspect
end

#pretty_print(q) ⇒ Object



1756
1757
1758
1759
1760
1761
1762
# File 'lib/test/unit/assertions.rb', line 1756

def pretty_print(q)
  q.group(1, '[', ']') do
    q.seplist(self) do |v|
      q.pp(v)
    end
  end
end

#pretty_print_cycle(q) ⇒ Object



1764
1765
1766
# File 'lib/test/unit/assertions.rb', line 1764

def pretty_print_cycle(q)
  @array.pretty_print_cycle(q)
end