class TermBuf::Meter

Overview

Counts the bytes going to the terminal on their way past.

Wrapping rather than buffering keeps the write path one pass: the encoder still writes straight through to the device, and the count is a single addition per write.

Defined in:

termbuf/terminal/meter.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(io : IO) #

[View source]

Instance Method Detail

def bytes : Int32 #

Bytes since this was last set to zero.


[View source]
def bytes=(bytes : Int32) #

Bytes since this was last set to zero.


[View source]
def flush : Nil #

Flushes the stream underneath.


[View source]
def read(slice : Bytes) : Int32 #

Always raises. A meter sits on the way out only.


[View source]
def write(slice : Bytes) : Nil #

Counts slice and passes it on.


[View source]