类 Test::Unit::Assertions::AssertionMessage::Inspector

属性

object[R]

公共类方法

cached_new(object, inspected_objects) 点击切换源代码
# File test-unit-3.6.7/lib/test/unit/assertions.rb, line 2095
def cached_new(object, inspected_objects)
  inspected_objects[object.__id__] ||=
    new(object, inspected_objects)
end
inspector_classes() 点击切换源代码
# File test-unit-3.6.7/lib/test/unit/assertions.rb, line 2101
def inspector_classes
  @@inspector_classes
end
new(object, inspected_objects={}) 点击切换源代码
# File test-unit-3.6.7/lib/test/unit/assertions.rb, line 2115
def initialize(object, inspected_objects={})
  @inspected_objects = inspected_objects
  @object = object
  @inspected_objects[@object.__id__] = self
  @inspect_target = inspect_target
end
register_inspector_class(inspector_class) 点击切换源代码
# File test-unit-3.6.7/lib/test/unit/assertions.rb, line 2105
def register_inspector_class(inspector_class)
  @@inspector_classes << inspector_class
end
unregister_inspector_class(inspector_class) 点击切换源代码
# File test-unit-3.6.7/lib/test/unit/assertions.rb, line 2109
def unregister_inspector_class(inspector_class)
  @@inspector_classes.delete(inspector_class)
end

公共实例方法

<=>(other) 点击切换源代码
# File test-unit-3.6.7/lib/test/unit/assertions.rb, line 2135
def <=>(other)
  if other.is_a?(self.class)
    @object <=> other.object
  else
    @object <=> other
  end
end
inspect() 点击切换源代码
# File test-unit-3.6.7/lib/test/unit/assertions.rb, line 2123
def inspect
  @inspect_target.inspect
end
也别名为: native_inspect
native_inspect()
别名: inspect
pretty_print(q) 点击切换源代码
# File test-unit-3.6.7/lib/test/unit/assertions.rb, line 2127
def pretty_print(q)
  @inspect_target.pretty_print(q)
end
pretty_print_cycle(q) 点击切换源代码
# File test-unit-3.6.7/lib/test/unit/assertions.rb, line 2131
def pretty_print_cycle(q)
  @inspect_target.pretty_print_cycle(q)
end

私有实例方法

inspect_target() 点击切换源代码
# File test-unit-3.6.7/lib/test/unit/assertions.rb, line 2144
def inspect_target
  self.class.inspector_classes.each do |inspector_class|
    if inspector_class.target?(@object)
      return inspector_class.new(@object, @inspected_objects)
    end
  end
  @object
end