Class: Observed::ProcReporter

Inherits:
Reporter
  • Object
show all
Defined in:
lib/observed/config_builder.rb

Instance Method Summary collapse

Methods included from Pluggable

included

Methods included from Configurable

#configure, #get_attribute_value, #has_attribute_value?, included

Constructor Details

#initialize(tag_pattern, &block) ⇒ ProcReporter

Returns a new instance of ProcReporter.



32
33
34
35
# File 'lib/observed/config_builder.rb', line 32

def initialize(tag_pattern, &block)
  @tag_pattern = tag_pattern
  @block = block
end

Instance Method Details

#match(tag) ⇒ Object



36
37
38
# File 'lib/observed/config_builder.rb', line 36

def match(tag)
  tag.match(@tag_pattern) if tag && @tag_pattern
end

#report(tag, time, data) ⇒ Object



39
40
41
# File 'lib/observed/config_builder.rb', line 39

def report(tag, time, data)
  @block.call data, {tag: tag, time: time}
end