Class: HexaPDF::Type::Signature::VerificationResult
- Inherits:
-
Object
- Object
- HexaPDF::Type::Signature::VerificationResult
- Defined in:
- lib/hexapdf/type/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
trueif 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
trueif there are no error messages.
Constructor Details
#initialize ⇒ VerificationResult
Creates an empty result object.
65 66 67 |
# File 'lib/hexapdf/type/signature/verification_result.rb', line 65 def initialize @messages = [] end |
Instance Attribute Details
#messages ⇒ Object (readonly)
An array with all result messages.
62 63 64 |
# File 'lib/hexapdf/type/signature/verification_result.rb', line 62 def @messages end |
Instance Method Details
#failure? ⇒ Boolean
Returns true if there is at least one error message.
75 76 77 |
# File 'lib/hexapdf/type/signature/verification_result.rb', line 75 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.
84 85 86 |
# File 'lib/hexapdf/type/signature/verification_result.rb', line 84 def log(type, content) @messages << Message.new(type, content) end |
#success? ⇒ Boolean
Returns true if there are no error messages.
70 71 72 |
# File 'lib/hexapdf/type/signature/verification_result.rb', line 70 def success? @messages.none? {|| .type == :error } end |