Class: Test::Unit::Assertions::AssertionMessage::Inspector

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, inspected_objects = {}) ⇒ Inspector

Returns a new instance of Inspector.



1545
1546
1547
1548
1549
1550
# File 'lib/test/unit/assertions.rb', line 1545

def initialize(object, inspected_objects={})
  @inspected_objects = inspected_objects
  @object = object
  @inspected_objects[@object.object_id] = self
  @inspect_target = inspect_target
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



1544
1545
1546
# File 'lib/test/unit/assertions.rb', line 1544

def object
  @object
end

Class Method Details

.cached_new(object, inspected_objects) ⇒ Object



1538
1539
1540
1541
# File 'lib/test/unit/assertions.rb', line 1538

def cached_new(object, inspected_objects)
  inspected_objects[object.object_id] ||=
    new(object, inspected_objects)
end

Instance Method Details

#<=>(other) ⇒ Object



1565
1566
1567
1568
1569
1570
1571
# File 'lib/test/unit/assertions.rb', line 1565

def <=>(other)
  if other.is_a?(self.class)
    @object <=> other.object
  else
    @object <=> other
  end
end

#inspectObject



1553
1554
1555
# File 'lib/test/unit/assertions.rb', line 1553

def inspect
  @inspect_target.inspect
end

#native_inspectObject



1552
# File 'lib/test/unit/assertions.rb', line 1552

alias_method :native_inspect, :inspect

#pretty_print(q) ⇒ Object



1557
1558
1559
# File 'lib/test/unit/assertions.rb', line 1557

def pretty_print(q)
  @inspect_target.pretty_print(q)
end

#pretty_print_cycle(q) ⇒ Object



1561
1562
1563
# File 'lib/test/unit/assertions.rb', line 1561

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