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
362 363 364 |
# File 'lib/rmail/parser.rb', line 362 def body_begin @body = nil end |
#body_chunk(chunk) ⇒ Object
365 366 367 368 369 370 371 |
# File 'lib/rmail/parser.rb', line 365 def body_chunk(chunk) if @body @body << chunk else @body = chunk end end |
#body_end ⇒ Object
372 373 374 |
# File 'lib/rmail/parser.rb', line 372 def body_end @parts.last.body = @body end |
#epilogue_chunk(chunk) ⇒ Object
386 387 388 389 390 391 392 |
# File 'lib/rmail/parser.rb', line 386 def epilogue_chunk(chunk) if @epilogues.last @epilogues.last << chunk else @epilogues[-1] = chunk end end |
#header_field(field, name, value) ⇒ Object
359 360 361 |
# File 'lib/rmail/parser.rb', line 359 def header_field(field, name, value) @parts.last.header.add_raw(field) end |
#mbox_from(field) ⇒ Object
356 357 358 |
# File 'lib/rmail/parser.rb', line 356 def mbox_from(field) @parts.last.header.mbox_from = field end |
#message ⇒ Object
408 409 410 |
# File 'lib/rmail/parser.rb', line 408 def @parts.first end |
#multipart_body_begin ⇒ Object
375 376 377 378 |
# File 'lib/rmail/parser.rb', line 375 def multipart_body_begin @preambles.push(nil) @epilogues.push(nil) end |
#multipart_body_end(delimiters, boundary) ⇒ Object
393 394 395 396 397 398 399 400 |
# File 'lib/rmail/parser.rb', line 393 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
401 402 403 |
# File 'lib/rmail/parser.rb', line 401 def part_begin @parts << RMail::Message.new end |
#part_end ⇒ Object
404 405 406 407 |
# File 'lib/rmail/parser.rb', line 404 def part_end part = @parts.pop @parts.last.add_part(part) end |
#preamble_chunk(chunk) ⇒ Object
379 380 381 382 383 384 385 |
# File 'lib/rmail/parser.rb', line 379 def preamble_chunk(chunk) if @preambles.last @preambles.last << chunk else @preambles[-1] = chunk end end |