Class: HexaPDF::DigitalSignature::VerificationResult

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeVerificationResult

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

#messagesObject (readonly)

An array with all result messages.



58
59
60
# File 'lib/hexapdf/digital_signature/verification_result.rb', line 58

def messages
  @messages
end

Instance Method Details

#failure?Boolean

Returns true if there is at least one error message.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


66
67
68
# File 'lib/hexapdf/digital_signature/verification_result.rb', line 66

def success?
  @messages.none? {|message| message.type == :error }
end