Class TTK::Filters::Saver
In: lib/ttk/filters/Saver.rb
Parent: Filter

This very basic filter, observe a logger, and save all received messages, without any formatting.

With this observer you save a sort of execution trace. After that you can apply to another logger the same message sequence.

You can also simply check that two results are equal, for that, just compare the sequence message.

Methods

each   get   new   repeat   update  

Included Modules

Concrete

Public Class methods

[Source]

# File lib/ttk/filters/Saver.rb, line 25
      def initialize
        @out = []
      end

Public Instance methods

[Source]

# File lib/ttk/filters/Saver.rb, line 52
      def each ( &block )
        @out.each(&block)
      end

[Source]

# File lib/ttk/filters/Saver.rb, line 38
      def get
        @out.dup
      end

[Source]

# File lib/ttk/filters/Saver.rb, line 42
      def repeat ( log )
        if !@out.empty? and @out[0][1] == 'root'
          @out[0][1] = 'sub root'
        end
        @out.each do |a|
          a[2] = a[2].to_sym if a[2].is_a? String
          log.send(*a)
        end
      end

[Source]

# File lib/ttk/filters/Saver.rb, line 29
      def update ( *args )
        msg, path, node, type = args
        a = [msg]
        a << path.last.first if msg == :new_node
        a << node unless node.nil?
        a << type unless type.nil?
        @out << a
      end

[Validate]