Class: Mantra::Certificates::Cortege

Inherits:
Object
  • Object
show all
Defined in:
lib/mantra/certificates/cortege.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Cortege

Returns a new instance of Cortege.



8
9
10
11
12
# File 'lib/mantra/certificates/cortege.rb', line 8

def initialize(options)
  self.public_key  = options[:public_key]
  self.private_key = options[:private_key]
  self.certificate = options[:certificate]
end

Instance Attribute Details

#certificateObject

Returns the value of attribute certificate.



7
8
9
# File 'lib/mantra/certificates/cortege.rb', line 7

def certificate
  @certificate
end

#private_keyObject

Returns the value of attribute private_key.



7
8
9
# File 'lib/mantra/certificates/cortege.rb', line 7

def private_key
  @private_key
end

#public_keyObject

Returns the value of attribute public_key.



7
8
9
# File 'lib/mantra/certificates/cortege.rb', line 7

def public_key
  @public_key
end

Instance Method Details

#has_certificate?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/mantra/certificates/cortege.rb', line 25

def has_certificate?
  !!self.certificate
end

#has_private_key?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/mantra/certificates/cortege.rb', line 33

def has_private_key?
  !!self.private_key
end

#has_public_key?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/mantra/certificates/cortege.rb', line 29

def has_public_key?
  !!self.public_key
end

#matches?Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
21
22
23
# File 'lib/mantra/certificates/cortege.rb', line 14

def matches?
  if self.has_private_key? && self.has_certificate?
    return private_key_matches_certificate?
  elsif self.has_private_key? && self.has_public_key?
    return private_key_matches_public_key?
  else
    puts "Warning: don't know what to do with following certificate cortege #{self.inspect}"
    return false
  end
end