Sha256: 8bd55d10b28daca40da06e852ed4fcd2a4d2226d6a2342b759a6c737fda8c601

Contents?: true

Size: 451 Bytes

Versions: 2

Compression:

Stored size: 451 Bytes

Contents

module Railgun

  class Attachment < StringIO

    attr_reader :source_filename, :content_type, :path

    def initialize(attachment, *args)
      @path = ''
      if args.detect { |opt| opt[:inline] }
        basename = @source_filename = attachment.cid
      else
        basename = @source_filename = attachment.filename
      end

      @content_type = attachment.content_type.split(';')[0]

      super attachment.body.decoded
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mailgun-ruby-1.1.4 lib/railgun/attachment.rb
mailgun-ruby-1.1.3 lib/railgun/attachment.rb