Sha256: 6ad2071b080fe30a91db400a4fbefb4dae23a22e71da5c65fb0a1b0e1be36fda

Contents?: true

Size: 691 Bytes

Versions: 43

Compression:

Stored size: 691 Bytes

Contents

# frozen_string_literal: true

require "refinements/arrays"

module Pennyworth
  module Loaders
    # Loads an array of encoding records.
    class Encodings
      using Refinements::Arrays

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

      def call _omit = nil
        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

43 entries across 43 versions & 1 rubygems

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