Class: Mail::Gpg::SignedPart

Inherits:
Part
  • Object
show all
Defined in:
lib/mail/gpg/signed_part.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(cleartext_mail) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/mail/gpg/signed_part.rb', line 9

def self.build(cleartext_mail)
  new do
    if cleartext_mail.body.multipart?
      if cleartext_mail.content_type =~ /^(multipart[^;]+)/
        # preserve multipart/alternative etc
        content_type $1
      else
        content_type 'multipart/mixed'
      end
      cleartext_mail.body.parts.each do |p|
        add_part p
      end
    else
      content_type cleartext_mail.content_type
      body cleartext_mail.body.raw_source
    end
  end
end

Instance Method Details

#sign(options) ⇒ Object



28
29
30
# File 'lib/mail/gpg/signed_part.rb', line 28

def sign(options)
  SignPart.new(self, options)
end