module Observability::ObserverHooks

A mixin that allows events to be created for any current observers at runtime.

Public Instance Methods

observability() click to toggle source

Return the current Observability observer agent.

# File lib/observability/observer_hooks.rb, line 24
def observability
        return Observability.observer
end
observe( detail, **options, &block ) click to toggle source

Create an event at the current point of execution, make it the innermost context, then yield to the method's block. Finish the event when the yield returns, handling exceptions that are being raised automatically.

# File lib/observability/observer_hooks.rb, line 12
def observe( detail, **options, &block )
        if block
                marker = Observability.observer.event( [block, detail], **options )
                Observability.observer.finish_after_block( marker, &block )
        else
                Loggability[ Observability ].warn "No block given for %p -> %p with options: %p" %
                        [ self, detail, options ]
        end
end