Sha256: daad637523b92e1dad3a3e2cda7685c6f2e26659a2703cfc12b26307ad4c689c
Contents?: true
Size: 546 Bytes
Versions: 7
Compression:
Stored size: 546 Bytes
Contents
# frozen_string_literal: true 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
7 entries across 7 versions & 1 rubygems