Class: Mail::Attachment
Instance Attribute Summary
Attributes inherited from Part
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(str_part) ⇒ Attachment
constructor
A new instance of Attachment.
- #size ⇒ Object
Methods inherited from Part
Constructor Details
#initialize(str_part) ⇒ Attachment
Returns a new instance of Attachment.
5 6 7 8 |
# File 'lib/mail/attachment.rb', line 5 def initialize(str_part) super(str_part) @binary = nil end |
Instance Method Details
#content ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/mail/attachment.rb', line 14 def content unless @binary buffer = String.new body_found = false @part_str.each_line do |line| if body_found buffer << line end body_found = true if !body_found && line.strip.empty? end @binary = Base64.decode64(buffer) end return @binary end |
#size ⇒ Object
10 11 12 |
# File 'lib/mail/attachment.rb', line 10 def size content.size end |