Class: Mail::KeywordsField
- Inherits:
-
StructuredField
- Object
- StructuredField
- Mail::KeywordsField
- Defined in:
- lib/mail/fields/keywords_field.rb
Constant Summary collapse
- FIELD_NAME =
'keywords'
- CAPITALIZED_FIELD =
'Keywords'
Instance Method Summary collapse
- #decoded ⇒ Object
- #default ⇒ Object
- #encoded ⇒ Object
-
#initialize(*args) ⇒ KeywordsField
constructor
A new instance of KeywordsField.
- #keywords ⇒ Object
- #parse(val = value) ⇒ Object
- #phrase_list ⇒ Object
Methods included from Utilities
Methods included from CommonField
Constructor Details
#initialize(*args) ⇒ KeywordsField
Returns a new instance of KeywordsField.
10 11 12 13 14 |
# File 'lib/mail/fields/keywords_field.rb', line 10 def initialize(*args) super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last)) self.parse self end |
Instance Method Details
#decoded ⇒ Object
34 35 36 |
# File 'lib/mail/fields/keywords_field.rb', line 34 def decoded keywords.join(', ') end |
#default ⇒ Object
38 39 40 |
# File 'lib/mail/fields/keywords_field.rb', line 38 def default keywords end |
#encoded ⇒ Object
30 31 32 |
# File 'lib/mail/fields/keywords_field.rb', line 30 def encoded "#{CAPITALIZED_FIELD}: #{keywords.join(', ')}\r\n" end |
#keywords ⇒ Object
26 27 28 |
# File 'lib/mail/fields/keywords_field.rb', line 26 def keywords phrase_list.phrases end |
#parse(val = value) ⇒ Object
16 17 18 19 20 |
# File 'lib/mail/fields/keywords_field.rb', line 16 def parse(val = value) unless val.blank? @phrase_list ||= PhraseList.new(value) end end |
#phrase_list ⇒ Object
22 23 24 |
# File 'lib/mail/fields/keywords_field.rb', line 22 def phrase_list @phrase_list ||= PhraseList.new(value) end |