Class: InternetMessage::TraceBlockList
- Inherits:
-
Object
- Object
- InternetMessage::TraceBlockList
- Includes:
- Enumerable
- Defined in:
- lib/internet_message.rb
Instance Attribute Summary collapse
-
#blocks ⇒ Object
readonly
Returns the value of attribute blocks.
Instance Method Summary collapse
- #clean ⇒ Object
- #each ⇒ Object
-
#initialize ⇒ TraceBlockList
constructor
A new instance of TraceBlockList.
- #push(field) ⇒ Object
Constructor Details
#initialize ⇒ TraceBlockList
Returns a new instance of TraceBlockList.
359 360 361 362 363 |
# File 'lib/internet_message.rb', line 359 def initialize @block = TraceBlock.new @blocks = [@block] @state = nil end |
Instance Attribute Details
#blocks ⇒ Object (readonly)
Returns the value of attribute blocks.
356 357 358 |
# File 'lib/internet_message.rb', line 356 def blocks @blocks end |
Instance Method Details
#clean ⇒ Object
391 392 393 |
# File 'lib/internet_message.rb', line 391 def clean @blocks.delete_if(&:empty?) end |
#each ⇒ Object
395 396 397 398 399 |
# File 'lib/internet_message.rb', line 395 def each @blocks.each do |b| yield b end end |
#push(field) ⇒ Object
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 |
# File 'lib/internet_message.rb', line 366 def push(field) case field.name when 'return-path' @block = TraceBlock.new @blocks.push @block @block.push field @state = :return when 'received' unless @state == :return or @state == :received @block = TraceBlock.new @blocks.push @block end @block.push field @state = :received when /\Aresent-/ unless @state == :return or @state == :received or @state == :resent @block = TraceBlock.new @blocks.push @block end @block.push field @state = :resent end end |