Class Uttk::Dumpers::Dumper
In: lib/uttk/dumpers/Dumper.rb
Parent: Logger::Backend

The dumper is a specific Logger::Backend.

It react to method calls by writting in the output. The output must be acceded like that:

  * Using the print method
  * Using the puts method
  * Using the << method

If you really need to access to the real outputs use each_output.

You can safely call flush in your methods because this method take care of closed and unflushable outputs.

Methods

<<   each_output   flush   new   print   puts  

Included Modules

Abstract

Attributes

options  [RW] 

Public Class methods

[Source]

# File lib/uttk/dumpers/Dumper.rb, line 30
      def initialize ( output=STDOUT, *args )
        @outputs = [output]
        while args.first.is_a? IO do
          @outputs << args.shift
        end
        @options = args
        super()
      end

Public Instance methods

[Source]

# File lib/uttk/dumpers/Dumper.rb, line 66
      def << ( arg )
        each_output do |o|
          o << arg
        end
        self
      end

[Source]

# File lib/uttk/dumpers/Dumper.rb, line 47
      def each_output ( &block )
        @outputs.each(&block)
      end

[Source]

# File lib/uttk/dumpers/Dumper.rb, line 40
      def flush
        each_output do |o|
          o.flush if o.respond_to? :flush and (not o.closed?)
        end
      end

[Source]

# File lib/uttk/dumpers/Dumper.rb, line 59
      def print ( *args )
        each_output do |o|
          o.print(*args)
        end
      end

[Source]

# File lib/uttk/dumpers/Dumper.rb, line 52
      def puts ( *args )
        each_output do |o|
          o.puts(*args)
        end
      end

[Validate]