Class: MooTool::Commands::Certificate

Inherits:
Thor
  • Object
show all
Defined in:
lib/mootool/commands/certificate.rb

Overview

Commands for interacting with certificates

Instance Method Summary collapse

Instance Method Details

#indexObject



31
32
33
34
35
36
37
38
39
# File 'lib/mootool/commands/certificate.rb', line 31

def index
  Models::FileIndex.current.index.each do |file|
    Models.file_guesser(file.fullname)
  end

  Models::CertificateIndex.current.save options[:save_file] if options[:save_file]

  ap(Models::CertificateIndex.current.index)
end


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/mootool/commands/certificate.rb', line 10

def print(file)
  @certificates = Models::Certificate.load(file)

  friendly = options[:friendly]
  mappings = Models::IMG4.mappings
  if friendly
    @certificates.map do |certificate|
      certificate.to_h.deep_transform_keys do |key|
        new_key = mappings.dig(key.to_s, 'title') || mappings.dig(key.to_s, 'description') || key
        new_key.respond_to?(:to_sym) ? new_key.to_sym : new_key
      end
    end
  end

  @certificates.each do |_certificate|
    ap c
  end
end