Class: String

Inherits:
Object
  • Object
show all
Includes:
CertMunger
Defined in:
lib/cert_munger/string.rb

Overview

rubocop:disable Documentation

Constant Summary

Constants included from CertMunger

CertMunger::VERSION

Instance Method Summary collapse

Methods included from CertMunger

included

Instance Method Details

#to_certObject

Returns an X509 certificate after parsing the value of this object. Returns false if an X509 certificate cannot be created.



6
7
8
9
10
11
12
13
14
# File 'lib/cert_munger/string.rb', line 6

def to_cert
  begin
    new_cert = self.class.send(:to_cert, self)
  rescue StandardError
    new_cert = false
  end

  new_cert
end

#to_cert!Object

Similar to #to_cert, but raises an error unless the string can be explicitly parsed to an X509 certifcate.



18
19
20
21
22
23
24
25
26
27
# File 'lib/cert_munger/string.rb', line 18

def to_cert!
  begin
    new_cert = self.class.send(:to_cert, self)
  rescue StandardError
    raise UnparsableCertError,
          "Could not force conversion to X509:\n#{inspect}"
  end

  new_cert
end