Sha256: a1082bca7ec0fc6269467189346cb8b66ff6a37f8cda601d5c8d4179ce28d304
Contents?: true
Size: 1.32 KB
Versions: 5
Compression:
Stored size: 1.32 KB
Contents
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>. # Copyright:: Copyright (c) 2004, 2005 TTK team. All rights reserved. # License:: LGPL # $Id: Saver.rb 567 2005-04-13 08:00:06Z polrop $ module TTK module Filters # # 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. # class Saver < Filter include Concrete def initialize @out = [] end 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 def get @out.dup end 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 def each ( &block ) @out.each(&block) end end # class Saver end # module Filters end # TTK
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
ttk-0.1.576 | lib/ttk/filters/Saver.rb |
ttk-0.2.0 | lib/ttk/filters/Saver.rb |
ttk-0.2.1 | lib/ttk/filters/Saver.rb |
ttk-0.1.579 | lib/ttk/filters/Saver.rb |
ttk-0.1.580 | lib/ttk/filters/Saver.rb |