2ea70030c774 — Gerald Klix (MGE702687) 4 years ago
SUM: Added some things for the BEE project.
1 files changed, 14 insertions(+), 1 deletions(-)

M gf/go.py
M gf/go.py +14 -1
@@ 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`.")