Class: SMail::MIME::ContentDisposition

Inherits:
ContentField show all
Defined in:
lib/smail/mime/content_fields.rb

Overview

An object representing a Content-Disposition header as specified in RFC2183.

Instance Attribute Summary

Attributes inherited from ContentField

#params, #type_raw

Instance Method Summary collapse

Methods inherited from ContentField

#initialize, #type, #type=

Constructor Details

This class inherits a constructor from SMail::MIME::ContentField

Instance Method Details

#attachment?Boolean

Is this an attachment part?

Returns:

  • (Boolean)


73
74
75
# File 'lib/smail/mime/content_fields.rb', line 73

def attachment?
  type == "attachment"
end

#creation_dateObject

Returns the creation date if available or nil.



83
84
85
# File 'lib/smail/mime/content_fields.rb', line 83

def creation_date
  self.params['creation-date'] # FIXME: parse as a date?
end

#filenameObject

Returns the filename if specified



78
79
80
# File 'lib/smail/mime/content_fields.rb', line 78

def filename
  self.params['filename']
end

#inline?Boolean

Is this an inline part??

Returns:

  • (Boolean)


68
69
70
# File 'lib/smail/mime/content_fields.rb', line 68

def inline?
  type == 'inline'
end

#modification_dateObject

Returns the modification date if available or nil.



88
89
90
# File 'lib/smail/mime/content_fields.rb', line 88

def modification_date
  self.params['modification-date'] # FIXME: parse as a date?
end

#read_dateObject

Returns the read date if available or nil.



93
94
95
# File 'lib/smail/mime/content_fields.rb', line 93

def read_date
  self.params['read-date'] # FIXME: parse as a date?
end

#sizeObject

Returns the size if available or nil.



98
99
100
# File 'lib/smail/mime/content_fields.rb', line 98

def size
  self.params['size']
end

#to_sObject

Returns the Content-Disposition as a string suitable for inclusion in an email header. If no disposition type is specified it will default to a disposition type of ‘attachment’.



107
108
109
# File 'lib/smail/mime/content_fields.rb', line 107

def to_s
  "#{self.type_raw || 'attachment'}#{self.params.to_s}"
end