Subclasses of BasicObject are rare in general, but pretty common in testing/mocking frameworks.
Today, the logic in print_variable will raise NoMethodError for such objects, and always hit this rescue:
|
print_debug "Unexpected exception \"%s\"\n%s", e.to_s, e.backtrace.join("\n") |
|
print("<variable name=\"%s\" kind=\"%s\" value=\"%s\"/>", |
|
CGI.escapeHTML(name), kind, CGI.escapeHTML(safe_to_string(value))) |
You can see this other PR of mine to see what's involved, but in short:
- Replacing
object.is_a?(Foo) with Foo === object
- Replacing
object.to_s with Kernel.instance_method(:to_s).bind_call(object)
Before I try this, would this be a welcome contribution to merge?