Sha256: d1168b214e13bdd17b9aff7f735e84c77f2ade716506eb2df1d40f1bcfb1d5eb

Contents?: true

Size: 652 Bytes

Versions: 6

Compression:

Stored size: 652 Bytes

Contents

class BufferWriter
  def initialize()
    self.writer = new FileWriter()
  end

  defm set_output_file(output_file)
    self.writer.set_output_file(output_file)
  end

  defm write(line)
    self.writer.write(line)

    line = self.strip_colors(line)
    append(line('$'), line)
    :normal gJ
  end

  defm writeln(line)
    self.writer.writeln(line)

    line = self.strip_colors(line)
    append(line('$'), line)
    :normal G
  end

  defm flush()
    self.writer.flush()
  end

  defm flush_line()
    self.writer.flush_line()
  end

  " private methods

  def strip_colors(line)
    return substitute(line, '\e\[[0-9;]\+[mK]', '', 'g')
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
speckle-0.2.0 lib/writers/buffer_writer.riml
speckle-0.1.31 lib/writers/buffer_writer.riml
speckle-0.1.30 lib/writers/buffer_writer.riml
speckle-0.1.29 lib/writers/buffer_writer.riml
speckle-0.1.28 lib/writers/buffer_writer.riml
speckle-0.1.27 lib/writers/buffer_writer.riml