class String
Extend the core String
class to include `.to_cert` && `.to_cert!`
Public Instance Methods
to_cert()
click to toggle source
Returns an X509 certificate after parsing the value of this object. Returns false if an X509 certificate cannot be created
# File lib/cert_munger/string.rb, line 9 def to_cert begin new_cert = self.class.send(:to_cert, self) rescue StandardError new_cert = false end new_cert end
to_cert!()
click to toggle source
Similar to {#to_cert}, but raises an error unless the string can be explicitly parsed to an X509 certifcate
# File lib/cert_munger/string.rb, line 21 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