Sha256: 3a579c71dc753784f88975c955a1f930f884f1abadb98636bb354b2ed847051c

Contents?: true

Size: 810 Bytes

Versions: 5

Compression:

Stored size: 810 Bytes

Contents

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

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

require_relative 'base_io'

class Trepan
  class OutputNull < Trepan::OutputBase
    def initialize(out, opts={})
      super
    end

    def close
    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
end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
trepanning-0.1.2 io/null_output.rb
trepanning-0.1.1 io/null_output.rb
trepanning-0.1.0 io/null_output.rb
trepanning-0.0.9 io/null_output.rb
trepanning-0.0.8 io/null_output.rb