Re: Live to_s calls for rexml attribute

Another would be to subclass REXML::Element, find all the existing
methods where the to_s is invoked on attributes, and override those
methods to delay the evaluation.

FWIW, I found that the above doesn’t work, since REXML::Element uses
REXML::Attribute to store each attribute, so I can’t subclass that and
have the rest of REXML use it.

Since it’s only a two-line modification (though it requires copying 40
lines of source code from REXML), I’ve now decided to include a patch to
REXML as part of my library.

Still hoping someone out there has a more elegant solution, though.

(I’ve also filed an REXML enhancement request, so maybe 3.1.5 will
include it and make my patch unnecessary.)