Class: ORDO::Message::Parser
- Inherits:
-
Object
- Object
- ORDO::Message::Parser
- Defined in:
- lib/ordo/message/parser.rb
Overview
Parses valid ORDO messages
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize ⇒ Parser
constructor
A new instance of Parser.
- #parse(message_bytes) ⇒ Object
- #to_ordo_message ⇒ Object
Constructor Details
#initialize ⇒ Parser
Returns a new instance of Parser.
12 13 14 15 16 17 18 |
# File 'lib/ordo/message/parser.rb', line 12 def initialize @scanner = nil @line = nil @version = nil @fields = nil @body = nil end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
10 11 12 |
# File 'lib/ordo/message/parser.rb', line 10 def body @body end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
10 11 12 |
# File 'lib/ordo/message/parser.rb', line 10 def fields @fields end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
10 11 12 |
# File 'lib/ordo/message/parser.rb', line 10 def version @version end |
Instance Method Details
#parse(message_bytes) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ordo/message/parser.rb', line 20 def parse() @line = 1 @scanner = StringScanner.new() parse_prefix @fields = {} parse_field until body self end |