Sha256: 33692c749422e697190e235be4d55eaa0fb33c95a0e8f07aaf1c898528e81133

Contents?: true

Size: 900 Bytes

Versions: 7

Compression:

Stored size: 900 Bytes

Contents

# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>

# Nukes output. Used for example in sourcing where you don't want
# to see output.
# 

require 'rubygems'; require 'require_relative'
require_relative '../io'

class Trepan::OutputNull < Trepan::OutputBase
  def initialize(out, opts={})
    @closed = false
    super
  end
  
  def close
    @closed = true
  end
  
  def closed?
    !!@closed
  end
  
  def flush
  end
  
  # Use this to set where to write to. output can be a 
  # file object or a string. This code raises IOError on error.
  def write(*args)
  end
  
  # used to write to a debugger that is connected to this
  # `str' written will have a newline added to it
  #
  def writeline( msg)
  end
end

# Demo it
if __FILE__ == $0
  output = Trepan::OutputNull.new(nil)
  p output
  output.write("Invisible")
  output.writeline("Invisible")
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
rbx-trepanning-0.2.1-universal-rubinius-2.0 io/null_output.rb
rbx-trepanning-0.2.1-universal-rubinius-1.2 io/null_output.rb
rbx-trepanning-0.2.0-universal-rubinius-2.0 io/null_output.rb
rb8-trepanning-0.1.6 io/null_output.rb
rb8-trepanning-0.1.5 io/null_output.rb
rbx-trepanning-0.1.0-universal-rubinius-1.2 io/null_output.rb
rb8-trepanning-0.1.4 io/null_output.rb