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.



1966
1967
1968
1969
1970
1971
# File 'lib/test/unit/assertions.rb', line 1966

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)


1961
1962
1963
# File 'lib/test/unit/assertions.rb', line 1961

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

Instance Method Details

#each(&block) ⇒ Object



1989
1990
1991
# File 'lib/test/unit/assertions.rb', line 1989

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

#inspectObject



1973
1974
1975
# File 'lib/test/unit/assertions.rb', line 1973

def inspect
  @array.inspect
end

#pretty_print(q) ⇒ Object



1977
1978
1979
1980
1981
1982
1983
# File 'lib/test/unit/assertions.rb', line 1977

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

#pretty_print_cycle(q) ⇒ Object



1985
1986
1987
# File 'lib/test/unit/assertions.rb', line 1985

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