Class: Fluent::StatusClass

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/status.rb

Instance Method Summary collapse

Constructor Details

#initializeStatusClass

Returns a new instance of StatusClass.



19
20
21
22
# File 'lib/fluent/status.rb', line 19

def initialize
  @entries = {}
  @mutex = Mutex.new
end

Instance Method Details

#each(&block) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/fluent/status.rb', line 31

def each(&block)
  @mutex.synchronize {
    @entries.each {|obj_id,hash|
      record = {}
      hash.each_pair {|name,block|
        record[name] = block.call
      }
      block.call(record)
    }
  }
end

#register(instance, name, &block) ⇒ Object



24
25
26
27
28
29
# File 'lib/fluent/status.rb', line 24

def register(instance, name, &block)
  @mutex.synchronize {
    (@entries[instance.object_id] ||= {})[name] = block
  }
  nil
end