saturnflyer/surrounded

View on GitHub
lib/surrounded/exceptions.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
module Surrounded
  module Exceptions
    def self.define(klass, exceptions:, namespace: Surrounded::Context)
      Array(exceptions).each { |exception|
        unless klass.const_defined?(exception)
          klass.const_set(exception, Class.new(namespace.const_get(exception)))
        end
      }
    end
  end
end