class QuantifiableStdout

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.

Attributes

size[R]

Public Class Methods

new(delegate) click to toggle source
Calls superclass method
# File lib/asciidoctor/pdf/ext/core/quantifiable_stdout.rb, line 13
def initialize delegate
  @size = 0
  super
  delegate.binmode
end

Public Instance Methods

<<(content) click to toggle source
Calls superclass method
# File lib/asciidoctor/pdf/ext/core/quantifiable_stdout.rb, line 19
def << content
  @size += content.to_s.bytesize
  super
end
write(content) click to toggle source
Calls superclass method
# File lib/asciidoctor/pdf/ext/core/quantifiable_stdout.rb, line 24
def write content
  @size += content.to_s.bytesize
  super
end