Class: Dtn::Messages::MessageWithSimpleParser

Inherits:
Dtn::Message
  • Object
show all
Defined in:
lib/dtn/messages/message_with_simple_parser.rb

Overview

Lookup Message abstraction

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Dtn::Message

callback_name, #callback_name

Class Method Details

.parse(line:, request: nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/dtn/messages/message_with_simple_parser.rb', line 8

def parse(line:, request: nil, **)
  values = line.split(",")

  new.tap do |n|
    apply_values instance: n, attributes: fields, values: values
    if respond_to?(:parse_dynamic_fields)
      parse_dynamic_fields(instance: n, values: values[(fields.size)..], request: request)
    end
    n.after_initialization if n.respond_to?(:after_initialization)
  end
end

Instance Method Details

#termination?Boolean

After receiving termination Message Request will be marked as finished and #each method successfully finalize the iteration

Returns:

  • (Boolean)


33
34
35
# File 'lib/dtn/messages/message_with_simple_parser.rb', line 33

def termination?
  false
end