Skip to content

Feature request: support BasicObject variables #246

@amomchilov

Description

@amomchilov

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:

  1. Replacing object.is_a?(Foo) with Foo === object
  2. 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions