Method: Hallmonitor::Monitored#emit

Defined in:
lib/hallmonitor/monitored.rb

#emit(event = nil) ⇒ Object

Emits an event: either self or an event if one is passed in, or constructs a base event from the passed in param If the parameter is a #Hallmonitor::Event, it will be emitted as is. Otherwise, a new Hallmonitor::Event will be created with the parameter and emitted.



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/hallmonitor/monitored.rb', line 49

def emit(event = nil)
  to_emit = self;
  if(!event.nil?)
    to_emit = event.kind_of?(Hallmonitor::Event) ? event : Hallmonitor::Event.new(event)
  end
  
  # If we were given a block, then we want to execute that
  if block_given?
    yield(to_emit)
  end
  
  Outputter.output(to_emit)
end