Sha256: 9642022d6b95a1d5368d75790efd92db38c851fb80954be38da58e80315267dc

Contents?: true

Size: 697 Bytes

Versions: 24

Compression:

Stored size: 697 Bytes

Contents

# frozen_string_literal: true

module Pennyworth
  module Loaders
    module System
      # Loads an array of system error records.
      class Errors
        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

24 entries across 24 versions & 1 rubygems

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