@@ 23,7 23,8 @@ operations = {}
"__float__", "__int__",
"AbstractObject", "Object", "FinalizingMixin",
"Writer", "IndentingWriter",
- "spy", "as_string", "push", "pop", "indent", "dedent",
+ "spy", "as_string", "as_indented_string", "get_text",
+ "push", "pop", "indent", "dedent",
"CSep", "csep",
]
@@ 458,6 459,18 @@ def as_string(self):
__out__(self, writer)
return get_text(writer)
+@generic
+def as_indented_string(self):
+ """Answer an object's indented string.
+
+ This is done by creating a :class:`IndentingWriter` instance
+ and calling the :func:`__out__` generic with the
+ object and the writer. The using :meth:`Writer.get_text`
+ to retrieve the text written."""
+ writer = IndentingWriter()
+ __out__(self, writer)
+ return get_text(writer)
+
__out__ = generic("__out__",
"Create a print string of an object using a :class:`Writer`.")