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.



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

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.



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

def object
  @object
end

Class Method Details

.cached_new(object, inspected_objects) ⇒ Object



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

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

Instance Method Details

#<=>(other) ⇒ Object



1572
1573
1574
1575
1576
1577
1578
# File 'lib/test/unit/assertions.rb', line 1572

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

#inspectObject



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

def inspect
  @inspect_target.inspect
end

#native_inspectObject



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

alias_method :native_inspect, :inspect

#pretty_print(q) ⇒ Object



1564
1565
1566
# File 'lib/test/unit/assertions.rb', line 1564

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

#pretty_print_cycle(q) ⇒ Object



1568
1569
1570
# File 'lib/test/unit/assertions.rb', line 1568

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