Class: EmlToPdf::ExtractionStep
- Inherits:
-
Object
- Object
- EmlToPdf::ExtractionStep
- Defined in:
- lib/eml_to_pdf/extraction_step.rb
Constant Summary collapse
- MIME_TYPES =
{ plain_text: 'text/plain', html: 'text/html', multipart_alternative: 'multipart/alternative' }
Instance Method Summary collapse
- #finished? ⇒ Boolean
-
#initialize(mail_or_part) ⇒ ExtractionStep
constructor
A new instance of ExtractionStep.
- #next ⇒ Object
- #to_html ⇒ Object
Constructor Details
#initialize(mail_or_part) ⇒ ExtractionStep
Returns a new instance of ExtractionStep.
9 10 11 |
# File 'lib/eml_to_pdf/extraction_step.rb', line 9 def initialize(mail_or_part) @mail_or_part = mail_or_part end |
Instance Method Details
#finished? ⇒ Boolean
24 25 26 |
# File 'lib/eml_to_pdf/extraction_step.rb', line 24 def finished? !@mail_or_part.multipart? end |
#next ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/eml_to_pdf/extraction_step.rb', line 13 def next if multipart_alternative?(@mail_or_part) best_part = extract_best_part(@mail_or_part.parts) ExtractionStep.new(best_part) elsif @mail_or_part.multipart? ExtractionStepList.new(@mail_or_part.parts.map { |part| ExtractionStep.new(part) }) else self end end |
#to_html ⇒ Object
28 29 30 |
# File 'lib/eml_to_pdf/extraction_step.rb', line 28 def to_html text_body(@mail_or_part) end |