Class: Postmark::MittTempfile

Inherits:
Tempfile
  • Object
show all
Defined in:
lib/postmark/mitt.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(basename, content_type, tmpdir = Dir::tmpdir) ⇒ MittTempfile

Returns a new instance of MittTempfile.



151
152
153
154
155
156
157
158
159
# File 'lib/postmark/mitt.rb', line 151

def initialize(basename, content_type, tmpdir=Dir::tmpdir)
  if Postmark.ruby19?
    super(basename, tmpdir, :encoding => 'ascii-8bit')
  else
    super(basename, tmpdir)
  end
  @basename = basename
  @content_type = content_type
end

Instance Attribute Details

#content_typeObject

the content type of the “uploaded” file



162
163
164
# File 'lib/postmark/mitt.rb', line 162

def content_type
  @content_type
end

Instance Method Details

#original_filenameObject



164
165
166
# File 'lib/postmark/mitt.rb', line 164

def original_filename
  @basename || file.basename(path)
end