Class: HexaPDF::DigitalSignature::VerificationResult
- Inherits:
-
Object
- Object
- HexaPDF::DigitalSignature::VerificationResult
- Defined in:
- lib/hexapdf/digital_signature/verification_result.rb
Overview
Holds the result of verifying a signature.
Defined Under Namespace
Classes: Message
Constant Summary collapse
- MESSAGE_SORT_MAP =
:nodoc:
{ # :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.
61 62 63 |
# File 'lib/hexapdf/digital_signature/verification_result.rb', line 61 def initialize @messages = [] end |
Instance Attribute Details
#messages ⇒ Object (readonly)
An array with all result messages.
58 59 60 |
# File 'lib/hexapdf/digital_signature/verification_result.rb', line 58 def @messages end |
Instance Method Details
#failure? ⇒ Boolean
Returns true
if there is at least one error message.
71 72 73 |
# File 'lib/hexapdf/digital_signature/verification_result.rb', line 71 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.
80 81 82 |
# File 'lib/hexapdf/digital_signature/verification_result.rb', line 80 def log(type, content) @messages << Message.new(type, content) end |
#success? ⇒ Boolean
Returns true
if there are no error messages.
66 67 68 |
# File 'lib/hexapdf/digital_signature/verification_result.rb', line 66 def success? @messages.none? {|| .type == :error } end |