Sha256: 7b7f94a910bc3cd90e69e2b99c8d9a51985984eb6ad3cb4149ef6ef2191d1eb8

Contents?: true

Size: 456 Bytes

Versions: 6

Compression:

Stored size: 456 Bytes

Contents

require 'stringio'

module ParallelSplitTest
  class OutputRecorder
    def initialize(out)
      @recorded = StringIO.new
      @out = out
    end

    %w[puts write print putc flush].each do |method|
      class_eval <<-RUBY, __FILE__, __LINE__
        def #{method}(*args)
          @recorded.#{method}(*args)
          @out.#{method}(*args)
        end
      RUBY
    end

    def recorded
      @recorded.rewind
      @recorded.read
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
parallel_split_test-0.6.0 lib/parallel_split_test/output_recorder.rb
parallel_split_test-0.5.0 lib/parallel_split_test/output_recorder.rb
parallel_split_test-0.4.1 lib/parallel_split_test/output_recorder.rb
parallel_split_test-0.4.0 lib/parallel_split_test/output_recorder.rb
parallel_split_test-0.3.0 lib/parallel_split_test/output_recorder.rb
parallel_split_test-0.2.1 lib/parallel_split_test/output_recorder.rb