Sha256: 6057c48c31f2a112b9df85f596b5bb772b83a933c346a768faad17599947637d

Contents?: true

Size: 681 Bytes

Versions: 17

Compression:

Stored size: 681 Bytes

Contents

# frozen_string_literal: true

require "refinements/array"

module Pennyworth
  module Loaders
    # Loads an array of encoding records.
    class Encoding
      using Refinements::Array

      def initialize encoding: ::Encoding, model: Models::Encoding
        @encoding = encoding
        @model = model
      end

      def call(*)
        encoding.aliases
                .map { |_second, first| first }
                .uniq
                .sort
                .map do |first|
                  model[name: first, aliases: encoding.find(first).names.sort.excluding(first)]
                end
      end

      private

      attr_reader :encoding, :model
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

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