Class: Mail::ContentDispositionField
- Inherits:
-
StructuredField
- Object
- StructuredField
- Mail::ContentDispositionField
- Defined in:
- lib/mail/fields/content_disposition_field.rb
Constant Summary collapse
- FIELD_NAME =
'content-disposition'
- CAPITALIZED_FIELD =
'Content-Disposition'
Instance Method Summary collapse
- #decoded ⇒ Object
- #disposition_type ⇒ Object
- #element ⇒ Object
-
#encoded ⇒ Object
TODO: Fix this up.
- #filename ⇒ Object
-
#initialize(*args) ⇒ ContentDispositionField
constructor
A new instance of ContentDispositionField.
- #parameters ⇒ Object
- #parse(val = value) ⇒ Object
Methods inherited from StructuredField
Methods included from Utilities
Methods included from CommonField
Constructor Details
#initialize(*args) ⇒ ContentDispositionField
Returns a new instance of ContentDispositionField.
11 12 13 14 15 16 |
# File 'lib/mail/fields/content_disposition_field.rb', line 11 def initialize(*args) super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last)) self.parse self end |
Instance Method Details
#decoded ⇒ Object
55 56 57 |
# File 'lib/mail/fields/content_disposition_field.rb', line 55 def decoded value end |
#disposition_type ⇒ Object
28 29 30 |
# File 'lib/mail/fields/content_disposition_field.rb', line 28 def disposition_type element.disposition_type end |
#element ⇒ Object
24 25 26 |
# File 'lib/mail/fields/content_disposition_field.rb', line 24 def element @element ||= Mail::ContentDispositionElement.new(value) end |
#encoded ⇒ Object
TODO: Fix this up
51 52 53 |
# File 'lib/mail/fields/content_disposition_field.rb', line 51 def encoded "#{CAPITALIZED_FIELD}: #{value}\r\n" end |
#filename ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/mail/fields/content_disposition_field.rb', line 38 def filename case when !parameters['filename'].blank? @filename = parameters['filename'] when !parameters['name'].blank? @filename = parameters['name'] else @filename = nil end @filename end |
#parameters ⇒ Object
32 33 34 35 36 |
# File 'lib/mail/fields/content_disposition_field.rb', line 32 def parameters @parameters = ParameterHash.new element.parameters.each { |p| @parameters.merge!(p) } @parameters end |
#parse(val = value) ⇒ Object
18 19 20 21 22 |
# File 'lib/mail/fields/content_disposition_field.rb', line 18 def parse(val = value) unless val.blank? @element = Mail::ContentDispositionElement.new(val) end end |