Class: Uttk::Filters::Compact

Inherits:
Id show all
Includes:
Concrete
Defined in:
lib/uttk/filters/Compact.rb

Defined Under Namespace

Classes: InternalError

Instance Method Summary collapse

Methods inherited from Filter

composition, #notif

Methods inherited from Logger::Backend

#update

Constructor Details

#initialize(*a, &b) ⇒ Compact

Returns a new instance of Compact.



17
18
19
20
# File 'lib/uttk/filters/Compact.rb', line 17

def initialize ( *a, &b )
  super
  @record = {}
end

Instance Method Details

#new_leaf(path, leaf) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/uttk/filters/Compact.rb', line 59

def new_leaf ( path, leaf )
  if @record.empty?
    # We are recording nothing so we transmit the message as is.
    super
  else
    # Each buffer receive the message
    @record.each do |path_s, buf|
      buf.first.update(:new_leaf, path, leaf)
    end
  end
end