Class: Pdm::Attachment

Inherits:
Object
  • Object
show all
Defined in:
lib/pdm/attachment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mail_attachment) ⇒ Attachment



7
8
9
10
# File 'lib/pdm/attachment.rb', line 7

def initialize(mail_attachment)
  self.mail_attachment = mail_attachment
  self.eof = false
end

Instance Attribute Details

#eofObject

Returns the value of attribute eof.



5
6
7
# File 'lib/pdm/attachment.rb', line 5

def eof
  @eof
end

#mail_attachmentObject

Returns the value of attribute mail_attachment.



4
5
6
# File 'lib/pdm/attachment.rb', line 4

def mail_attachment
  @mail_attachment
end

Instance Method Details

#eof?Boolean



13
14
15
# File 'lib/pdm/attachment.rb', line 13

def eof?
  self.eof == true
end

#pathObject



26
27
28
# File 'lib/pdm/attachment.rb', line 26

def path
  mail_attachment.filename
end

#read(bytes) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/pdm/attachment.rb', line 17

def read(bytes)
  if eof?
    nil
  else
    self.eof = true
    mail_attachment.read
  end
end