Class: Fix::Protocol::UnorderedPart

Inherits:
MessagePart show all
Defined in:
lib/fix/protocol/unordered_part.rb

Overview

Represents a collection of unordered fields

Instance Attribute Summary

Attributes inherited from MessagePart

#delegations, #name, #parse_failure

Instance Method Summary collapse

Methods inherited from MessagePart

collection, #dump, #errors, field, inherited, #initialize, #initialize_node, #node_for_name, #nodes, parent_delegate, parse, part, structure, unordered

Constructor Details

This class inherits a constructor from Fix::Protocol::MessagePart

Instance Method Details

#parse(str) ⇒ String

Parses a full or partial FIX message string into the message part nodes

Returns:

  • (String)

    The string part that wasn't consumed during the parsing


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fix/protocol/unordered_part.rb', line 14

def parse(str)

  left_to_parse     = str
  left_before_pass  = nil

  while (left_to_parse != left_before_pass) && !parse_failure

    left_before_pass = left_to_parse

    nodes.each do |node|
      if node.can_parse?(left_to_parse)
        left_to_parse = node.parse(left_to_parse)
        self.parse_failure = node.parse_failure
      end
    end
  end

  left_to_parse
end