Class: RMail::Parser::Handler
- Inherits:
-
StreamHandler
- Object
- StreamHandler
- RMail::Parser::Handler
- Defined in:
- lib/rmail/parser.rb
Overview
:nodoc:
Instance Method Summary collapse
- #body_begin ⇒ Object
- #body_chunk(chunk) ⇒ Object
- #body_end ⇒ Object
- #epilogue_chunk(chunk) ⇒ Object
- #header_field(field, name, value) ⇒ Object
-
#initialize ⇒ Handler
constructor
A new instance of Handler.
- #mbox_from(field) ⇒ Object
- #message ⇒ Object
- #multipart_body_begin ⇒ Object
- #multipart_body_end(delimiters, boundary) ⇒ Object
- #part_begin ⇒ Object
- #part_end ⇒ Object
- #preamble_chunk(chunk) ⇒ Object
Constructor Details
Instance Method Details
#body_begin ⇒ Object
360 361 362 |
# File 'lib/rmail/parser.rb', line 360 def body_begin @body = nil end |
#body_chunk(chunk) ⇒ Object
363 364 365 366 367 368 369 |
# File 'lib/rmail/parser.rb', line 363 def body_chunk(chunk) if @body @body << chunk else @body = chunk end end |
#body_end ⇒ Object
370 371 372 |
# File 'lib/rmail/parser.rb', line 370 def body_end @parts.last.body = @body end |
#epilogue_chunk(chunk) ⇒ Object
384 385 386 387 388 389 390 |
# File 'lib/rmail/parser.rb', line 384 def epilogue_chunk(chunk) if @epilogues.last @epilogues.last << chunk else @epilogues[-1] = chunk end end |
#header_field(field, name, value) ⇒ Object
357 358 359 |
# File 'lib/rmail/parser.rb', line 357 def header_field(field, name, value) @parts.last.header.add_raw(field) end |
#mbox_from(field) ⇒ Object
354 355 356 |
# File 'lib/rmail/parser.rb', line 354 def mbox_from(field) @parts.last.header.mbox_from = field end |
#message ⇒ Object
406 407 408 |
# File 'lib/rmail/parser.rb', line 406 def @parts.first end |
#multipart_body_begin ⇒ Object
373 374 375 376 |
# File 'lib/rmail/parser.rb', line 373 def multipart_body_begin @preambles.push(nil) @epilogues.push(nil) end |
#multipart_body_end(delimiters, boundary) ⇒ Object
391 392 393 394 395 396 397 398 |
# File 'lib/rmail/parser.rb', line 391 def multipart_body_end(delimiters, boundary) @parts.last.preamble = @preambles.pop @parts.last.epilogue = @epilogues.pop if @parts.last.body.nil? @parts.last.body = [] end @parts.last.set_delimiters(delimiters, boundary) end |
#part_begin ⇒ Object
399 400 401 |
# File 'lib/rmail/parser.rb', line 399 def part_begin @parts << RMail::Message.new end |
#part_end ⇒ Object
402 403 404 405 |
# File 'lib/rmail/parser.rb', line 402 def part_end part = @parts.pop @parts.last.add_part(part) end |
#preamble_chunk(chunk) ⇒ Object
377 378 379 380 381 382 383 |
# File 'lib/rmail/parser.rb', line 377 def preamble_chunk(chunk) if @preambles.last @preambles.last << chunk else @preambles[-1] = chunk end end |