Sha256: cd0dfc951f49eb5fc19db9015c327109cf9f3e0d047fd107e9c6ad19521464d1

Contents?: true

Size: 705 Bytes

Versions: 24

Compression:

Stored size: 705 Bytes

Contents

# frozen_string_literal: true

module Pennyworth
  module Loaders
    # Loads an array of standard error records.
    class StandardErrors
      def initialize root: StandardError, model: Models::StandardError
        @root = root
        @model = model
      end

      def call _omit = nil
        ObjectSpace.each_object(Class)
                   .select { |klass| klass < root }
                   .sort_by(&:name)
                   .map do |error|
                     file_path, line_number = Object.const_source_location error.name
                     model[name: error, file_path:, line_number:]
                   end
      end

      private

      attr_reader :root, :model
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
pennyworth-15.4.1 lib/pennyworth/loaders/standard_errors.rb
pennyworth-15.4.0 lib/pennyworth/loaders/standard_errors.rb
pennyworth-15.3.0 lib/pennyworth/loaders/standard_errors.rb
pennyworth-15.2.0 lib/pennyworth/loaders/standard_errors.rb
pennyworth-15.1.1 lib/pennyworth/loaders/standard_errors.rb
pennyworth-15.1.0 lib/pennyworth/loaders/standard_errors.rb
pennyworth-15.0.3 lib/pennyworth/loaders/standard_errors.rb
pennyworth-15.0.2 lib/pennyworth/loaders/standard_errors.rb
pennyworth-15.0.1 lib/pennyworth/loaders/standard_errors.rb
pennyworth-15.0.0 lib/pennyworth/loaders/standard_errors.rb
pennyworth-14.3.0 lib/pennyworth/loaders/standard_errors.rb
pennyworth-14.2.1 lib/pennyworth/loaders/standard_errors.rb
pennyworth-14.2.0 lib/pennyworth/loaders/standard_errors.rb
pennyworth-14.1.2 lib/pennyworth/loaders/standard_errors.rb
pennyworth-14.1.1 lib/pennyworth/loaders/standard_errors.rb
pennyworth-14.1.0 lib/pennyworth/loaders/standard_errors.rb
pennyworth-14.0.0 lib/pennyworth/loaders/standard_errors.rb
pennyworth-13.8.0 lib/pennyworth/loaders/standard_errors.rb
pennyworth-13.7.0 lib/pennyworth/loaders/standard_errors.rb
pennyworth-13.6.0 lib/pennyworth/loaders/standard_errors.rb