refactor the string_buffer #to_s method with inject + proc

refactor the to_s method in the string buffer to utilize inject and a proc