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.



1934
1935
1936
1937
1938
1939
# File 'lib/test/unit/assertions.rb', line 1934

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)


1929
1930
1931
# File 'lib/test/unit/assertions.rb', line 1929

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

Instance Method Details

#each(&block) ⇒ Object



1957
1958
1959
# File 'lib/test/unit/assertions.rb', line 1957

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

#inspectObject



1941
1942
1943
# File 'lib/test/unit/assertions.rb', line 1941

def inspect
  @array.inspect
end

#pretty_print(q) ⇒ Object



1945
1946
1947
1948
1949
1950
1951
# File 'lib/test/unit/assertions.rb', line 1945

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

#pretty_print_cycle(q) ⇒ Object



1953
1954
1955
# File 'lib/test/unit/assertions.rb', line 1953

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