Class: Mailgun::Attachment

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attachment, *rest) ⇒ Attachment

Returns a new instance of Attachment.



5
6
7
8
9
10
11
12
13
14
# File 'lib/mailgun/attachment.rb', line 5

def initialize (attachment, *rest)
  @path = ''
  if rest.detect {|opt| opt[:inline] }
    basename = @original_filename = attachment.cid
  else
    basename = @original_filename = attachment.filename
  end
  @content_type = attachment.content_type.split(';')[0]
  super attachment.body.decoded
end

Instance Attribute Details

#content_typeObject (readonly)

Returns the value of attribute content_type.



3
4
5
# File 'lib/mailgun/attachment.rb', line 3

def content_type
  @content_type
end

#original_filenameObject (readonly)

Returns the value of attribute original_filename.



3
4
5
# File 'lib/mailgun/attachment.rb', line 3

def original_filename
  @original_filename
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/mailgun/attachment.rb', line 3

def path
  @path
end