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

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

Constant Summary collapse

@@inspector_classes =
[]

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



1829
1830
1831
1832
1833
1834
# File 'lib/test/unit/assertions.rb', line 1829

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



1828
1829
1830
# File 'lib/test/unit/assertions.rb', line 1828

def object
  @object
end

Class Method Details

.cached_new(object, inspected_objects) ⇒ Object



1809
1810
1811
1812
# File 'lib/test/unit/assertions.rb', line 1809

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

.inspector_classesObject



1815
1816
1817
# File 'lib/test/unit/assertions.rb', line 1815

def inspector_classes
  @@inspector_classes
end

.register_inspector_class(inspector_class) ⇒ Object



1819
1820
1821
# File 'lib/test/unit/assertions.rb', line 1819

def register_inspector_class(inspector_class)
  @@inspector_classes << inspector_class
end

.unregister_inspector_class(inspector_class) ⇒ Object



1823
1824
1825
# File 'lib/test/unit/assertions.rb', line 1823

def unregister_inspector_class(inspector_class)
  @@inspector_classes.delete(inspector_class)
end

Instance Method Details

#<=>(other) ⇒ Object



1849
1850
1851
1852
1853
1854
1855
# File 'lib/test/unit/assertions.rb', line 1849

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

#inspectObject



1837
1838
1839
# File 'lib/test/unit/assertions.rb', line 1837

def inspect
  @inspect_target.inspect
end

#native_inspectObject



1836
1837
1838
# File 'lib/test/unit/assertions.rb', line 1836

def inspect
  @inspect_target.inspect
end

#pretty_print(q) ⇒ Object



1841
1842
1843
# File 'lib/test/unit/assertions.rb', line 1841

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

#pretty_print_cycle(q) ⇒ Object



1845
1846
1847
# File 'lib/test/unit/assertions.rb', line 1845

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