Class: String
Overview
Extend the core String class to include .to_cert && .to_cert!
Constant Summary
Constants included from CertMunger
Instance Method Summary collapse
-
#to_cert ⇒ Object
Returns an X509 certificate after parsing the value of this object.
-
#to_cert! ⇒ Object
Similar to #to_cert, but raises an error unless the string can be explicitly parsed to an X509 certifcate.
Methods included from CertMunger
Instance Method Details
#to_cert ⇒ Object
Returns an X509 certificate after parsing the value of this object. Returns false if an X509 certificate cannot be created
9 10 11 12 13 14 15 16 17 |
# 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! ⇒ Object
Similar to #to_cert, but raises an error unless the string can be explicitly parsed to an X509 certifcate
21 22 23 24 25 26 27 28 29 30 |
# 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 |