# Renderers for Box # module Rockit module PrettyPrint module Box class Renderer def reset_buffer @buffer = "" end def string_buffer @buffer end def render(boxTree) reset_buffer render_term(boxTree) string_buffer end def <<(string) @buffer << string end def render_term(boxTree) raise NotImplementedError end def render_hdelim(num) render_term(horizontal_delim * num) end end end end end class String def render_as_text(renderer) renderer << self end end