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.



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

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.



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

def object
  @object
end

Class Method Details

.cached_new(object, inspected_objects) ⇒ Object



1531
1532
1533
1534
# File 'lib/test/unit/assertions.rb', line 1531

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

Instance Method Details

#<=>(other) ⇒ Object



1558
1559
1560
1561
1562
1563
1564
# File 'lib/test/unit/assertions.rb', line 1558

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

#inspectObject



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

def inspect
  @inspect_target.inspect
end

#native_inspectObject



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

alias_method :native_inspect, :inspect

#pretty_print(q) ⇒ Object



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

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

#pretty_print_cycle(q) ⇒ Object



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

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