Sha256: dcbf52baaee051653c881d13aa505e8a5ce9f556ca75bc2af45cd150582ef3db

Contents?: true

Size: 762 Bytes

Versions: 19

Compression:

Stored size: 762 Bytes

Contents

# frozen_string_literal: true

require "refinements/arrays"

module Pennyworth
  module Loaders
    module System
      # Loads an array of system error records.
      class Errors
        using Refinements::Arrays

        def initialize errno: Errno, model: Models::System::Error
          @errno = errno
          @model = model
        end

        def call _omit = nil
          errno.constants
               .map { |name| errno.const_get name }
               .uniq
               .sort_by { |error| error::Errno }
               .map do |error|
                 model[id: error::Errno, name: error.name, description: error.exception.message]
               end
        end

        private

        attr_reader :errno, :model
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
pennyworth-13.1.0 lib/pennyworth/loaders/system/errors.rb
pennyworth-13.0.1 lib/pennyworth/loaders/system/errors.rb
pennyworth-13.0.0 lib/pennyworth/loaders/system/errors.rb
pennyworth-12.3.1 lib/pennyworth/loaders/system/errors.rb
pennyworth-12.3.0 lib/pennyworth/loaders/system/errors.rb
pennyworth-12.2.0 lib/pennyworth/loaders/system/errors.rb
pennyworth-12.1.0 lib/pennyworth/loaders/system/errors.rb
pennyworth-12.0.2 lib/pennyworth/loaders/system/errors.rb
pennyworth-12.0.1 lib/pennyworth/loaders/system/errors.rb
pennyworth-12.0.0 lib/pennyworth/loaders/system/errors.rb
pennyworth-11.2.2 lib/pennyworth/loaders/system/errors.rb
pennyworth-11.2.1 lib/pennyworth/loaders/system/errors.rb
pennyworth-11.2.0 lib/pennyworth/loaders/system/errors.rb
pennyworth-11.1.3 lib/pennyworth/loaders/system/errors.rb
pennyworth-11.1.2 lib/pennyworth/loaders/system/errors.rb
pennyworth-11.1.1 lib/pennyworth/loaders/system/errors.rb
pennyworth-11.1.0 lib/pennyworth/loaders/system/errors.rb
pennyworth-11.0.1 lib/pennyworth/loaders/system/errors.rb
pennyworth-11.0.0 lib/pennyworth/loaders/system/errors.rb