Class: SMail::MIME::ContentField
- Inherits:
-
Object
- Object
- SMail::MIME::ContentField
- Defined in:
- lib/smail/mime/content_fields.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Params
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#type_raw ⇒ Object
The raw type as parsed from the message.
Instance Method Summary collapse
-
#initialize(text = nil) ⇒ ContentField
constructor
A new instance of ContentField.
-
#to_s ⇒ Object
Returns the Content Field as a string suitable for inclusion in an email header.
-
#type ⇒ Object
Returns the type as a lower case string.
- #type=(text) ⇒ Object
Constructor Details
#initialize(text = nil) ⇒ ContentField
Returns a new instance of ContentField.
10 11 12 13 14 15 16 |
# File 'lib/smail/mime/content_fields.rb', line 10 def initialize(text = nil) @params = Params.new unless text.nil? (@type_raw, params_raw) = SMail::MIME.decode_content_field(text) @params.replace(params_raw) end end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
8 9 10 |
# File 'lib/smail/mime/content_fields.rb', line 8 def params @params end |
#type_raw ⇒ Object
The raw type as parsed from the message.
7 8 9 |
# File 'lib/smail/mime/content_fields.rb', line 7 def type_raw @type_raw end |
Instance Method Details
#to_s ⇒ Object
Returns the Content Field as a string suitable for inclusion in an email header.
28 29 30 |
# File 'lib/smail/mime/content_fields.rb', line 28 def to_s "#{@type_raw}#{self.params.to_s}" end |
#type ⇒ Object
Returns the type as a lower case string
19 20 21 |
# File 'lib/smail/mime/content_fields.rb', line 19 def type @type_raw.nil? ? @type_raw : @type_raw.downcase end |
#type=(text) ⇒ Object
23 24 25 |
# File 'lib/smail/mime/content_fields.rb', line 23 def type=(text) @type_raw = text end |