Sha256: 954fa0bd3e3d10afb4d7c037a40413ad1fd9ca6615905483e81450d3a52c4e70

Contents?: true

Size: 646 Bytes

Versions: 6

Compression:

Stored size: 646 Bytes

Contents

module NdrError
  # contains logic for registering callbacks
  module Callbacks
    def self.extended(base)
      base.mattr_accessor :_after_log_callbacks
      base._after_log_callbacks = []
    end

    # Register callbacks that will be called after an exception
    # has been logged.
    #
    #   NdrError.after_log do |exception, fingerprint, log|
    #     # ...
    #   end
    #
    # Multiple callbacks can be registered.
    def after_log(&block)
      _after_log_callbacks << block
    end

    def run_after_log_callbacks(*args)
      _after_log_callbacks.each do |callback|
        callback.call(*args)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ndr_error-2.4.0 lib/ndr_error/callbacks.rb
ndr_error-2.3.2 lib/ndr_error/callbacks.rb
ndr_error-2.3.1 lib/ndr_error/callbacks.rb
ndr_error-2.3.0 lib/ndr_error/callbacks.rb
ndr_error-2.2.0 lib/ndr_error/callbacks.rb
ndr_error-2.1.0 lib/ndr_error/callbacks.rb