Sha256: a9c6efe448da11fa6b53d8597590e59f2bb8876daa321a5cbe9eca2f81c9128c

Contents?: true

Size: 440 Bytes

Versions: 1

Compression:

Stored size: 440 Bytes

Contents

class DealWithIt::Handler
  DEFAULT_EXCEPTION_HANDLER = ->(error) do
    raise error
  end.freeze

  attr_reader :exception, :callback

  def self.deal(exception, with: DEFAULT_EXCEPTION_HANDLER)
    @handler = new(exception, with)
  end

  def self.descendants
    ObjectSpace.each_object(Class).select { |klass| klass < self }
  end

  private

  def initialize(exception, with)
    @exception = exception
    @callback  = with
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
deal_with_it-0.1.0 lib/deal_with_it/handler.rb