Sha256: 4c183c2491b56e3ff7d4c45fb9a5d74bdaf74dc2959c0da90a022dda16c6a9be

Contents?: true

Size: 687 Bytes

Versions: 17

Compression:

Stored size: 687 Bytes

Contents

# frozen_string_literal: true

module Pennyworth
  module Loaders
    module System
      # Loads an array of system error records.
      class Error
        def initialize errno: Errno, model: Models::System::Error
          @errno = errno
          @model = model
        end

        def call(*)
          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

17 entries across 17 versions & 1 rubygems

Version Path
pennyworth-17.8.0 lib/pennyworth/loaders/system/error.rb
pennyworth-17.7.0 lib/pennyworth/loaders/system/error.rb
pennyworth-17.6.0 lib/pennyworth/loaders/system/error.rb
pennyworth-17.5.0 lib/pennyworth/loaders/system/error.rb
pennyworth-17.4.1 lib/pennyworth/loaders/system/error.rb
pennyworth-17.4.0 lib/pennyworth/loaders/system/error.rb
pennyworth-17.3.0 lib/pennyworth/loaders/system/error.rb
pennyworth-17.2.0 lib/pennyworth/loaders/system/error.rb
pennyworth-17.1.0 lib/pennyworth/loaders/system/error.rb
pennyworth-17.0.0 lib/pennyworth/loaders/system/error.rb
pennyworth-16.7.0 lib/pennyworth/loaders/system/error.rb
pennyworth-16.5.0 lib/pennyworth/loaders/system/error.rb
pennyworth-16.4.0 lib/pennyworth/loaders/system/error.rb
pennyworth-16.3.0 lib/pennyworth/loaders/system/error.rb
pennyworth-16.2.0 lib/pennyworth/loaders/system/error.rb
pennyworth-16.1.0 lib/pennyworth/loaders/system/error.rb
pennyworth-16.0.0 lib/pennyworth/loaders/system/error.rb