Class: Mail::PhraseList

Inherits:
Object
  • Object
show all
Includes:
Utilities
Defined in:
lib/mail/elements/phrase_list.rb

Instance Method Summary collapse

Methods included from Utilities

included

Constructor Details

#initialize(string) ⇒ PhraseList

Returns a new instance of PhraseList.



7
8
9
10
11
12
13
14
# File 'lib/mail/elements/phrase_list.rb', line 7

def initialize(string)
  parser = Mail::PhraseListsParser.new
  if tree = parser.parse(string)
    @phrases = tree.phrases
  else
    raise Mail::Field::ParseError, "PhraseList can not parse |#{string}|\nReason was: #{parser.failure_reason}\n"
  end
end

Instance Method Details

#phrasesObject



16
17
18
# File 'lib/mail/elements/phrase_list.rb', line 16

def phrases
  @phrases.map { |p| unquote(p.text_value) }
end