Class: HexaPDF::DigitalSignature::VerificationResult
- Inherits:
-
Object
- Object
- HexaPDF::DigitalSignature::VerificationResult
- Defined in:
- lib/hexapdf/digital_signature/verification_result.rb
Overview
Holds the result information when verifying a signature.
Defined Under Namespace
Classes: Message
Constant Summary collapse
- MESSAGE_SORT_MAP =
:nodoc:
{ info: {warning: 1, error: 1, info: 0}, warning: {info: -1, error: 1, warning: 0}, error: {info: -1, warning: -1, error: 0}, }
Instance Attribute Summary collapse
-
#messages ⇒ Object
readonly
An array with all result messages.
Instance Method Summary collapse
-
#failure? ⇒ Boolean
Returns
true
if there is at least one error message. -
#initialize ⇒ VerificationResult
constructor
Creates an empty result object.
-
#log(type, content) ⇒ Object
Adds a new message of the given type to this result object.
-
#success? ⇒ Boolean
Returns
true
if there are no error messages.
Constructor Details
#initialize ⇒ VerificationResult
Creates an empty result object.
62 63 64 |
# File 'lib/hexapdf/digital_signature/verification_result.rb', line 62 def initialize @messages = [] end |
Instance Attribute Details
#messages ⇒ Object (readonly)
An array with all result messages.
59 60 61 |
# File 'lib/hexapdf/digital_signature/verification_result.rb', line 59 def @messages end |
Instance Method Details
#failure? ⇒ Boolean
Returns true
if there is at least one error message.
72 73 74 |
# File 'lib/hexapdf/digital_signature/verification_result.rb', line 72 def failure? !success? end |
#log(type, content) ⇒ Object
Adds a new message of the given type to this result object.
type
-
One of :info, :warning or :error.
content
-
The log message.
81 82 83 |
# File 'lib/hexapdf/digital_signature/verification_result.rb', line 81 def log(type, content) @messages << Message.new(type, content) end |
#success? ⇒ Boolean
Returns true
if there are no error messages.
67 68 69 |
# File 'lib/hexapdf/digital_signature/verification_result.rb', line 67 def success? @messages.none? {|| .type == :error } end |