Class: Uttk::Filters::Saver
- Inherits:
-
Filter
- Object
- Logger::Backend
- Filter
- Uttk::Filters::Saver
- Includes:
- Concrete
- Defined in:
- lib/uttk/filters/Saver.rb
Overview
FIXME Path based
This very basic filter, observe a logger, and save all received leaves, 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.
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #get ⇒ Object
-
#initialize(*a, &b) ⇒ Saver
constructor
A new instance of Saver.
- #new_leaf(*args) ⇒ Object
- #to_uttk_log(log) ⇒ Object
Methods inherited from Filter
Methods inherited from Logger::Backend
Constructor Details
#initialize(*a, &b) ⇒ Saver
Returns a new instance of Saver.
26 27 28 29 |
# File 'lib/uttk/filters/Saver.rb', line 26 def initialize(*a, &b) super @out = [] end |
Instance Method Details
#each(&block) ⇒ Object
45 46 47 |
# File 'lib/uttk/filters/Saver.rb', line 45 def each ( &block ) @out.each(&block) end |
#get ⇒ Object
35 36 37 |
# File 'lib/uttk/filters/Saver.rb', line 35 def get @out.dup end |
#new_leaf(*args) ⇒ Object
31 32 33 |
# File 'lib/uttk/filters/Saver.rb', line 31 def new_leaf ( *args ) @out << args end |
#to_uttk_log(log) ⇒ Object
39 40 41 42 43 |
# File 'lib/uttk/filters/Saver.rb', line 39 def to_uttk_log ( log ) each do |a| log.update(:new_leaf, *a) end end |