Observability::

ObserverHooks

module

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

Public Instance Methods

anchor
observability()

Return the current Observability observer agent.

# File lib/observability/observer_hooks.rb, line 21
def observability
        return Observability.observer
end
anchor
observe( detail, **options, &block )

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 )
        raise LocalJumpError, "no block given" unless block

        marker = Observability.observer.event( [block, detail], **options )
        Observability.observer.finish_after_block( marker, &block )
end