Method: Mail::Message#default
- Defined in:
- lib/mail/message.rb
#default(sym, val = nil) ⇒ Object
Returns the default value of the field requested as a symbol.
Each header field has a :default method which returns the most common use case for that field, for example, the date field types will return a DateTime object when sent :default, the subject, or unstructured fields will return a decoded string of their value, the address field types will return a single addr_spec or an array of addr_specs if there is more than one.
1211 1212 1213 1214 1215 1216 1217 |
# File 'lib/mail/message.rb', line 1211 def default( sym, val = nil ) if val header[sym] = val elsif field = header[sym] field.default end end |