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.



2244
2245
2246
2247
2248
2249
# File 'lib/test/unit/assertions.rb', line 2244

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)


2239
2240
2241
# File 'lib/test/unit/assertions.rb', line 2239

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

Instance Method Details

#each(&block) ⇒ Object



2267
2268
2269
# File 'lib/test/unit/assertions.rb', line 2267

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

#inspectObject



2251
2252
2253
# File 'lib/test/unit/assertions.rb', line 2251

def inspect
  @array.inspect
end

#pretty_print(q) ⇒ Object



2255
2256
2257
2258
2259
2260
2261
# File 'lib/test/unit/assertions.rb', line 2255

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

#pretty_print_cycle(q) ⇒ Object



2263
2264
2265
# File 'lib/test/unit/assertions.rb', line 2263

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