Class: Test::Unit::Assertions::AssertionMessage::Inspector
- Inherits:
-
Object
- Object
- Test::Unit::Assertions::AssertionMessage::Inspector
- Includes:
- Comparable
- Defined in:
- lib/test/unit/assertions.rb
Constant Summary collapse
- @@inspector_classes =
[]
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Class Method Summary collapse
- .cached_new(object, inspected_objects) ⇒ Object
- .inspector_classes ⇒ Object
- .register_inspector_class(inspector_class) ⇒ Object
- .unregister_inspector_class(inspector_class) ⇒ Object
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(object, inspected_objects = {}) ⇒ Inspector
constructor
A new instance of Inspector.
- #inspect ⇒ Object
- #native_inspect ⇒ Object
- #pretty_print(q) ⇒ Object
- #pretty_print_cycle(q) ⇒ Object
Constructor Details
#initialize(object, inspected_objects = {}) ⇒ Inspector
Returns a new instance of Inspector.
2115 2116 2117 2118 2119 2120 |
# File '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 |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
2114 2115 2116 |
# File 'lib/test/unit/assertions.rb', line 2114 def object @object end |
Class Method Details
.cached_new(object, inspected_objects) ⇒ Object
2095 2096 2097 2098 |
# File 'lib/test/unit/assertions.rb', line 2095 def cached_new(object, inspected_objects) inspected_objects[object.__id__] ||= new(object, inspected_objects) end |
.inspector_classes ⇒ Object
2101 2102 2103 |
# File 'lib/test/unit/assertions.rb', line 2101 def inspector_classes @@inspector_classes end |
.register_inspector_class(inspector_class) ⇒ Object
2105 2106 2107 |
# File 'lib/test/unit/assertions.rb', line 2105 def register_inspector_class(inspector_class) @@inspector_classes << inspector_class end |
.unregister_inspector_class(inspector_class) ⇒ Object
2109 2110 2111 |
# File 'lib/test/unit/assertions.rb', line 2109 def unregister_inspector_class(inspector_class) @@inspector_classes.delete(inspector_class) end |
Instance Method Details
#<=>(other) ⇒ Object
2135 2136 2137 2138 2139 2140 2141 |
# File 'lib/test/unit/assertions.rb', line 2135 def <=>(other) if other.is_a?(self.class) @object <=> other.object else @object <=> other end end |
#inspect ⇒ Object
2123 2124 2125 |
# File 'lib/test/unit/assertions.rb', line 2123 def inspect @inspect_target.inspect end |
#native_inspect ⇒ Object
2122 |
# File 'lib/test/unit/assertions.rb', line 2122 alias_method :native_inspect, :inspect |
#pretty_print(q) ⇒ Object
2127 2128 2129 |
# File 'lib/test/unit/assertions.rb', line 2127 def pretty_print(q) @inspect_target.pretty_print(q) end |
#pretty_print_cycle(q) ⇒ Object
2131 2132 2133 |
# File 'lib/test/unit/assertions.rb', line 2131 def pretty_print_cycle(q) @inspect_target.pretty_print_cycle(q) end |