Module: Nl::StructuredPayload

Included in:
Raw::Message, SubMessage
Defined in:
nl/lib/nl/structured_payload.rb

Overview

Shared handling for a payload containing an optional fixed header followed by an optional attribute set.

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attributes ⇒ Object

Returns the value of attribute attributes.



9
10
11
# File 'nl/lib/nl/structured_payload.rb', line 9

def attributes
  @attributes
end

#fixed_header ⇒ Object

Returns the value of attribute fixed_header.



9
10
11
# File 'nl/lib/nl/structured_payload.rb', line 9

def fixed_header
  @fixed_header
end

Instance Method Details

#encode(encoder, external_selectors: []) ⇒ Object



56
57
58
59
# File 'nl/lib/nl/structured_payload.rb', line 56

def encode(encoder, external_selectors: [])
  fixed_header&.encode(encoder)
  attributes&.encode(encoder, external_selectors:)
end

#initialize(fixed_header = nil, attributes = nil) ⇒ Object



11
12
13
14
# File 'nl/lib/nl/structured_payload.rb', line 11

def initialize(fixed_header = nil, attributes = nil)
  @fixed_header = fixed_header
  @attributes = attributes
end