Sha256: 4244351631099dd3d7e4a0bb17d5ece4ffcd471c96c52c3561521e5df7278fe3

Contents?: true

Size: 1.31 KB

Versions: 12

Compression:

Stored size: 1.31 KB

Contents

# Copyright (c) 2013-2016 SUSE LLC
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 3 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, contact SUSE LLC.
#
# To contact SUSE about this file by physical or electronic mail,
# you may find current contact information at www.suse.com

# = TeeIO
#
# Class to allow the storage and forwarding of input at the same time
# For example if stderr output should be handled by our code but at the
# same time be put out directly
#
# To prevent for example double error messages data can be filtered
# before being passed on to the io_object
# Only the data passed along is filtered, not the data stored in this
# IO object.
class TeeIO < StringIO
  def initialize(io_object, io_filter = [])
    super()
    @io_object = io_object
    @io_filter = Array(io_filter)
  end

  def write(data)
    super
    @io_object.puts(data) unless @io_filter.include?(data)
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
machinery-tool-1.24.1 lib/tee_io.rb
machinery-tool-1.24.0 lib/tee_io.rb
machinery-tool-1.23.1 lib/tee_io.rb
machinery-tool-1.23.0 lib/tee_io.rb
machinery-tool-1.22.3 lib/tee_io.rb
machinery-tool-1.22.2 lib/tee_io.rb
machinery-tool-1.22.1 lib/tee_io.rb
machinery-tool-1.22.0 lib/tee_io.rb
machinery-tool-1.21.0 lib/tee_io.rb
machinery-tool-1.20.0 lib/tee_io.rb
machinery-tool-1.19.0 lib/tee_io.rb
machinery-tool-1.18.0 lib/tee_io.rb