Sha256: 022ab4170ef220b5a413d1e5fb710060ec3611dbaf43174a84a9f7d3509ff303
Contents?: true
Size: 516 Bytes
Versions: 11
Compression:
Stored size: 516 Bytes
Contents
require 'delegate' # A delegator that allows the size method to be used on the STDOUT object. # # The size of the content written to STDOUT cannot be measured normally. This # class wraps the STDOUT object so the cumulative size of the content passed to # the write method (while wrapped in this decorator) can be measured. class QuantifiableStdout < SimpleDelegator attr_reader :size def initialize delegate @size = 0 super end def write content @size += content.bytesize super end end
Version data entries
11 entries across 11 versions & 1 rubygems