Class: LetsCert::ChainFile

Inherits:
OpenSSLIOPlugin show all
Includes:
FileIOPluginMixin
Defined in:
lib/letscert/io_plugins/chain_file.rb

Overview

Chain file plugin

Author:

  • Sylvain Daubert

Direct Known Subclasses

FullChainFile

Constant Summary

Constants inherited from OpenSSLIOPlugin

OpenSSLIOPlugin::PEM_RE

Instance Attribute Summary

Attributes inherited from IOPlugin

#name

Instance Method Summary collapse

Methods included from FileIOPluginMixin

#load, #save_to_file

Methods inherited from OpenSSLIOPlugin

#dump_key, #initialize, #load_cert, #load_key

Methods inherited from IOPlugin

empty_data, #initialize, #load, register

Methods included from Loggable

included, #logger

Constructor Details

This class inherits a constructor from LetsCert::OpenSSLIOPlugin

Instance Method Details

#load_from_content(content) ⇒ Hash

Returns:

  • (Hash)


35
36
37
38
39
40
41
# File 'lib/letscert/io_plugins/chain_file.rb', line 35

def load_from_content(content)
  chain = []
  split_pems(content) do |pem|
    chain << load_cert(pem)
  end
  { chain: chain }
end

#persistedHash

Returns always get true for :chain key.

Returns:

  • (Hash)

    always get true for :chain key



30
31
32
# File 'lib/letscert/io_plugins/chain_file.rb', line 30

def persisted
  @persisted ||= { chain: true }
end

#save(data) ⇒ void

This method returns an undefined value.

Save chain.

Parameters:

  • data (Hash)


46
47
48
# File 'lib/letscert/io_plugins/chain_file.rb', line 46

def save(data)
  save_to_file(data[:chain].map { |c| dump_cert(c) }.join)
end