Class: Pennyworth::Loaders::Encoding

Inherits:
Object
  • Object
show all
Defined in:
lib/pennyworth/loaders/encoding.rb

Overview

Loads an array of encoding records.

Instance Method Summary collapse

Constructor Details

#initialize(encoding: ::Encoding, model: Models::Encoding) ⇒ Encoding

Returns a new instance of Encoding.



11
12
13
14
# File 'lib/pennyworth/loaders/encoding.rb', line 11

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

Instance Method Details

#callObject



16
17
18
19
20
21
22
23
24
# File 'lib/pennyworth/loaders/encoding.rb', line 16

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